LinuxQuestions.org
Welcome to the most active Linux Forum on the web.
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Software
User Name
Password
Linux - Software This forum is for Software issues.
Having a problem installing a new program? Want to know which application is best for the job? Post your question in this forum.

Notices


Reply
  Search this Thread
Old 03-01-2014, 01:01 PM   #1
pappin
LQ Newbie
 
Registered: Feb 2005
Posts: 14

Rep: Reputation: 0
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
 
Old 03-02-2014, 12:56 AM   #2
chrism01
LQ Guru
 
Registered: Aug 2004
Location: Sydney
Distribution: Centos 7.7 (?), Centos 8.1
Posts: 17,817

Rep: Reputation: 2554Reputation: 2554Reputation: 2554Reputation: 2554Reputation: 2554Reputation: 2554Reputation: 2554Reputation: 2554Reputation: 2554Reputation: 2554Reputation: 2554
sudo http://linux.die.net/man/8/sudo, http://linux.die.net/man/5/sudoers
 
Old 03-05-2014, 04:28 AM   #3
pappin
LQ Newbie
 
Registered: Feb 2005
Posts: 14

Original Poster
Rep: Reputation: 0
Thanks for your reply Chris - got it sorted

pappin
 
  


Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
user crontab, needs root privileges ?! hen770 Linux - Software 4 03-21-2011 10:08 AM
query over crontab rohit khare Linux - Server 1 07-29-2010 03:55 AM
[SOLVED] Crontab not working for non-root User ferventslacker Linux - Newbie 5 01-19-2010 10:50 AM
crontab for diffrent user than root doesnt work dlugasx Linux - Server 3 07-10-2009 07:38 AM
CRONTAB Query Keith Birch Linux - General 1 06-14-2005 09:13 AM

LinuxQuestions.org > Forums > Linux Forums > Linux - Software

All times are GMT -5. The time now is 08:15 PM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration