I'm using Ubuntu 11.10.
I've written a script, that synchronises a directory in ~ with a directory on /dev/sda4, using Unison. Before, I had this script running every five minutes with no problems, using crontab. Right now, I want to execute this script at startup, restart and shutdown only.
This is what the script looks like:
#!/bin/bash
unison -perms 0 -batch "/mnt/Data/Syncfolder/" "/home/myname/Syncfolder/"
My crontab configuration was as follows:
m h dom mon dow command
0,5,10,15,20,25,30,35,40,45,50,55 * * * * sh /usr/local/bin/s4lj.bash
Note that I copied the script from ~ to /usr/local/bin/ first, to avoid root problems.
I've read How to execute script on shutdown? and How to write an init script that will execute an existing start script?.
After doing that, I've done this:
I've made s4lj.bash executable, and then copied it to /etc/init.d/.
For startup, I've made a symlink in /etc/rc2.d/ to /etc/init.d/s4lj.bash, and renamed it to S70s4lj.bash.
For restart, I've made a symlink in /etc/rc6.d/ to /etc/init.d/s4lj.bash, and renamed it to K70s4lj.bash.
For shutdown, I've made a symlink in /etc/rc0.d/ to /etc/init.d/s4lj.bash, and renamed it to K70s4lj.bash.
Still, the script won't be run in any of these situations. How can I make the script get executed?
I'd be happiest with a proper *.conf file in /etc/init.
Thanks in advance.