LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - Software (https://www.linuxquestions.org/questions/linux-software-2/)
-   -   crontab - root user query (https://www.linuxquestions.org/questions/linux-software-2/crontab-root-user-query-4175496659/)

pappin 03-01-2014 01:01 PM

crontab - root user query
 
Hello all,

Can anyone please help me with a problem I'm having with crontab.

I have a bash script to do a tar backup. The script mails a log on completion to root but I would like a visual while the script is running.

The script is pdb-test-cron (rwx) root.

I have tried the following in my /etc/crontab while logged in as pappin

This works in as far as it opens an xterm window but fails because the script needs to run as root
* * * * * pappin DISPLAY=:0 xterm -hold -e /home/apps/dev/shell-scripts/pdb-test-cron

This doesn't work at all (unless I am logged in as root) - doesn't open xterm window or run the script
* * * * * root DISPLAY=:0 xterm -hold -e /home/apps/dev/shell-scripts/pdb-test-cron

I don't really want to be logged in as root to run the script.

Is there anyway to get this to work while logged in as a non-root user ?

Thanks very much

pappin

chrism01 03-02-2014 12:56 AM

sudo http://linux.die.net/man/8/sudo, http://linux.die.net/man/5/sudoers

pappin 03-05-2014 04:28 AM

Thanks for your reply Chris - got it sorted

pappin


All times are GMT -5. The time now is 12:43 PM.