upstart config to start sync daemon as non-root user
Posted
by
Rudiger Wolf
on Server Fault
See other posts from Server Fault
or by Rudiger Wolf
Published on 2010-09-28T05:37:09Z
Indexed on
2011/02/23
7:26 UTC
Read the original article
Hit count: 546
upstart
I am planning to use inosync to sync data from master server to several client servers. I have created a user called rsyncuser in both master and slaves with access permissions and passwordless ssh access from master to slave servers.
Inosync is working when I use it from the command line as rsyncuser.
Next I want this to start automatically when server is turned on. I figured upstart is the way to get this working.
I am unable to find the right upstart command to get this working.
Here is my upstart conf file. The problem seems to be around running "inosync -d -c /etc/inosync/inosync_rsyncuser.py" as a given user.
As you can see I have tried a number of various options!
description "start inosync to sync data to other CDN Servers as rsyncuser" console output #start on startup #stop on shutdown start on (net-device-up and local-filesystems) stop on runlevel [016] #start on runlevel [2345] #stop on runlevel [!2345] #kill timeout 30 env RUN_AS_USER=rsyncuser expect fork script echo "Inosync updtart job seems to have started" >> /tmp/upstart.log # exec sudo -u rsyncuser -c "ls -la" >> /tmp/upstart.log 2>&1 # LOGFILE=/var/log/logfile.`date +%Y-%m-%d`.log # exec su - $RUN_AS_USER -c "inosync -d -c /etc/inosync/inosync_rsyncuser.py" >> $LOGFILE 2>&1 # exec su -c "ls -la" >> /tmp/upstart.log 2>&1 # emit inosync_running end script
© Server Fault or respective owner