From d886f8d62d0d34faedf25eaa9ab31c7d17f22407 Mon Sep 17 00:00:00 2001 From: poikilos <7557867+poikilos@users.noreply.github.com> Date: Sat, 20 Feb 2016 15:20:55 -0500 Subject: [PATCH] improved --- set-minutely-crontab-job.sh | 13 +++++++++++-- 1 file changed, 11 insertions(+), 2 deletions(-) diff --git a/set-minutely-crontab-job.sh b/set-minutely-crontab-job.sh index 2770356..ec85c93 100644 --- a/set-minutely-crontab-job.sh +++ b/set-minutely-crontab-job.sh @@ -1,6 +1,15 @@ #!/bin/sh -sudo su - +#sudo su - # NOTE: this works only since user is a field on Ubuntu (on some GNU/Linux systems it is not, which is implied by omission at http://www.adminschoice.com/crontab-quick-reference) # Minute, Hour, Day of Month, Month (1 to 12), Day of Week # m h dom mon dow user command -echo "* * * * * root /home/owner/minetest/util/chunkymap-cronjob" >> /etc/crontab +cd ~ +MT_CHUNKYMAP_CRON_TMP=mts_cron.tmp +if [! -f "crontab.1st"]; +then +sudo cp /etc/crontab "crontab.1st" +fi +crontab -l > "$MT_CHUNKYMAP_CRON_TMP" +echo "* * * * * root /home/owner/minetest/util/chunkymap-cronjob" >> "$MT_CHUNKYMAP_CRON_TMP" +sudo crontab "$MT_CHUNKYMAP_CRON_TMP" +rm "$MT_CHUNKYMAP_CRON_TMP" \ No newline at end of file