LinuxQuestions.org
Share your knowledge at the LQ Wiki.
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie
User Name
Password
Linux - Newbie This Linux forum is for members that are new to Linux.
Just starting out and have a question? If it is not in the man pages or the how-to's this is the place!

Notices


Reply
  Search this Thread
Old 08-21-2003, 07:10 PM   #1
Newman_SCO
Member
 
Registered: Jul 2003
Location: Scotland, Fife
Distribution: Mandrake 9.1
Posts: 31

Rep: Reputation: 15
Arrow I'm confused - Crontab and Access Permissions


Wondering if you can help me.

I have a crontab under the username admin.
which is:

30 8 * * * admin echo "Contacting blahblah cgi remindme program"
30 8 * * * admin open www.blahblah.com/cgi-bin/remindme.cgi
5 * * * * admin /usr/local/bin/dhcpSMS.py

Silly questions maybe, but I need to know.

-Does the particular user need to be logged in for the crontab/s to work?

-Hopefully I have the syntax correct for opening a website. (to activate the script to trigger a cgi program)?

-Lastly the last line triggers a python script (new ip, e-mail script)
It needs access permissions to access certain commands in the scripts. i.e. ifconfig

So it doesn't work. I have given admin access rights ( "0" root)

But now admin login doesn't detect the crontab since it doesn't crontab under root.

I am confused now.

Thanks for any help, directing to any of the questions.

Have a good day!

Neil
 
Old 08-21-2003, 10:59 PM   #2
jdc2048
Member
 
Registered: Jul 2002
Location: Ohio, USA
Distribution: Redhat, Gentoo, Solaris, HP-UX, etc...
Posts: 391

Rep: Reputation: 30
Re: I'm confused - Crontab and Access Permissions

Quote:
Originally posted by Newman_SCO
-Does the particular user need to be logged in for the crontab/s to work?
No, crontab is a scheduler and does not require the user to be logged in.

Quote:
-Hopefully I have the syntax correct for opening a website. (to activate the script to trigger a cgi program)?
Don't know if that syntax will work (open [ url ]blah.blah.com[ url ]), I have never used it.

Quote:
-Lastly the last line triggers a python script (new ip, e-mail script)
It needs access permissions to access certain commands in the scripts. i.e. ifconfig

So it doesn't work. I have given admin access rights ( "0" root)

But now admin login doesn't detect the crontab since it doesn't crontab under root.
You changed your uid on admin to 0 (equivalent to root)? If so, how did you do this, by editing the passwd file directly or through a command?

Quote:
I am confused now.
Me too, lovely state of mind.
 
Old 08-22-2003, 10:28 AM   #3
Newman_SCO
Member
 
Registered: Jul 2003
Location: Scotland, Fife
Distribution: Mandrake 9.1
Posts: 31

Original Poster
Rep: Reputation: 15
"Me too, lovely state of mind."

Thanks for making me laugh needed that.


-So, each line I can just use "*" instead of a particular user.

I tried running the e-mail ip script manually. It worked.
But crontab doesn't run want to run it. Thought it was down to access rights.
Will try * instead of user . Hopefully that will work.

-I'm trying to find a command to open a webpage virtually. To trigger the cgi program. (No GUI) No luck so far in finding a command which will work.

(I did just edit passwd manually)

Thanks for helping out.

Neil
 
Old 08-24-2003, 08:57 PM   #4
jdc2048
Member
 
Registered: Jul 2002
Location: Ohio, USA
Distribution: Redhat, Gentoo, Solaris, HP-UX, etc...
Posts: 391

Rep: Reputation: 30
Editing the passwd file manually is a tricky process. If you changed your UID, then you have to change all your files in your home directory, your crontab, and any other files that you own to match the new UID. I highly recommend _not_ using this approach. If you need UID 0 rights, then use a package like sudo or run the cron job from root's crontab.

The crontab has no field for the user that the script is suppose to run as, so you need to remove that entirely. Try the following. (*again, I have never used the 'open' command, so I don't know if it will work)
Code:
30 8 * * * echo "Contacting blahblah cgi remindme program"
30 8 * * * open www.blahblah.com/cgi-bin/remindme.cgi
5 * * * * /usr/local/bin/dhcpSMS.py
You could put the stuff there in a root crontab if you needed it run as root or try the following;
Code:
30 8 * * * echo "Contacting blahblah cgi remindme program"
30 8 * * * open www.blahblah.com/cgi-bin/remindme.cgi
5 * * * * sudo /usr/local/bin/dhcpSMS.py
Run that in admin's crontab, but you will have to configure your sudoers file to allow admin to run commands with no password (via the NOPASSWD option)
Then you could also change your UID back to a non-zero number as well.

Last edited by jdc2048; 08-24-2003 at 09:01 PM.
 
Old 08-24-2003, 09:08 PM   #5
Newman_SCO
Member
 
Registered: Jul 2003
Location: Scotland, Fife
Distribution: Mandrake 9.1
Posts: 31

Original Poster
Rep: Reputation: 15
Thank you for explaining things to me.
I understand that user "0" (like root) in passwd is quite a silly thing to do.

I have now edited the main crontab file. under /etc/crontab.

It works exactly as I wanted with no problems.

Thank you jdc2048.
 
Old 09-03-2003, 09:28 PM   #6
dnbrown
LQ Newbie
 
Registered: Feb 2003
Location: North Carolina, USA
Distribution: RH
Posts: 5

Rep: Reputation: 0
Quote:
-I'm trying to find a command to open a webpage virtually. To trigger the cgi program. (No GUI) No luck so far in finding a command which will work.
-----------------------

You need to investigate: curl

Good luck!!
 
  


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
Permissions for Samba Access BerlinBadger Linux - Networking 1 10-28-2005 10:13 AM
Netatalk Access Permissions nutthick Linux - Networking 1 12-14-2004 09:25 AM
File access permissions gumbald Slackware 4 10-22-2004 09:23 PM
Pretty confused about using numbers for file permissions Squall Linux - General 3 04-21-2004 10:17 PM
M$ Proxy with access permissions StuartGrant Linux - Newbie 4 05-31-2001 10:48 AM


All times are GMT -5. The time now is 12:52 AM.

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
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration