crontab as user in jail

Status
Not open for further replies.

FlyingPersian

Patron
Joined
Jan 27, 2014
Messages
237
Hi
I'm trying to run crontab as a user, non-root, in a jail. The crontab entry looks as follows

Code:
SHELL=/bin/sh
PATH=/etc:/bin:/sbin:/usr/bin:/usr/sbin
# Order of crontab fields
# minute hour   mday    month   wday    command
16      1       *       *       *       /media/music.sh


The log looks like this:

Code:
Apr 13 01:16:00 owncloud2 /usr/sbin/cron[9126]: (remotebackuper) RELOAD (tabs/remotebackuper)
Apr 13 01:16:00 owncloud2 /usr/sbin/cron[44866]: (remotebackuper) CMD (/media/music.sh)


Doing the same thing as root looks like this:

Crontab:
Code:
SHELL=/bin/sh
PATH=/etc:/bin:/sbin:/usr/bin:/usr/sbin
# Order of crontab fields
# minute hour   mday    month   wday    command
14      1       *       *       *       /media/rsync.sh


Log:
Code:
Apr 13 01:14:00 owncloud2 /usr/sbin/cron[44764]: (root) CMD (/media/rsync.sh)


Root's crontab does run the script, while the remotebackuper's crontab doesn't. Why is it working for root, but not for the user? Running the script manually (./music.sh) as the user works fine. Permissions are thus set correctly to +x and ownership goes to remotebackuper:remotebackuper (I know it's a dumbass name, couldn't think of anything better at 4am :D). I can tell that root's crontab is working because it's rsyncing something and the file appears after crontab ran the script. Same goes for remotebackuper, except that the file doesn't pop up.
 

FlyingPersian

Patron
Joined
Jan 27, 2014
Messages
237
I figured it out! I have to use the full path to rsync in the script. Found the answer here. The thread owner had the exact same issue with a rsync script. Also, see #2 here.
 
Last edited:
Status
Not open for further replies.
Top