I added the file grive.sh
to /etc/cron.daily
but the command doesn't seem to be running. I also copied it to /etc/cron.hourly
but there has been no change to my Google Drive directory only. The file has only three lines:
#! /bin/sh
cd /media/james/Seagate Expansion Drive/GD
grive
The permissions are read-only so I'll update those.
I used /etc/cron.hourly# chmod u+rwx grive.sh
, but then when I check the permissions for the file in Nautilus, they are unchanged—I don't know why.
I can run grive
manually from the terminal, and the files sync locally and online.
root@james-Streacom:/etc/cron.hourly# grep CRON /var/log/syslog
Feb 1 09:17:02 james-Streacom CRON[8696]: (root) CMD ( cd / && run-parts --report /etc/cron.hourly)
Feb 1 10:17:01 james-Streacom CRON[10958]: (root) CMD ( cd / && run-parts --report /etc/cron.hourly)
Feb 1 11:17:01 james-Streacom CRON[12897]: (root) CMD ( cd / && run-parts --report /etc/cron.hourly)
Feb 1 12:17:01 james-Streacom CRON[15307]: (root) CMD ( cd / && run-parts --report /etc/cron.hourly)
Feb 1 13:17:01 james-Streacom CRON[17043]: (root) CMD ( cd / && run-parts --report /etc/cron.hourly)
Feb 1 14:17:01 james-Streacom CRON[17354]: (root) CMD ( cd / && run-parts --report /etc/cron.hourly)
Feb 1 15:17:01 james-Streacom CRON[17705]: (root) CMD ( cd / && run-parts --report /etc/cron.hourly)
root@james-Streacom:/etc/cron.hourly# cd / && run-parts --report /etc/cron.hourly
root@james-Streacom:/# bash -c "cd / && run-parts --report /etc/cron.hourly"
root@james-Streacom:/#
Note that this may be a duplicate of The cron job doesn't work when put in `/etc/cron.hourly/` but work when defined in `crontab -e`, I'm just going through those steps.
I added echo test >/tmp/foobar.tmp
to the last line of the script.
root@james-Streacom:/etc/cron.hourly# grep 'cron\.hourly' /etc/crontab
17 * * * * root cd / && run-parts --report /etc/cron.hourly
/temp/foobar.tmp
doesn't exist.
I tried to actually run # cd /media/james/Seagate Expansion Drive/GD
, and got the error -su: cd: too many arguments
. I then changed the cd line in the script to cd /media/james/"Seagate Expansion Drive"/GD
.
$ echo test >/tmp/foobar.tmp
does create the file with test in it.
# echo test2 >/tmp/foobar.tmp
overwrites test with test2.