LinuxQuestions.org
Share your knowledge at the LQ Wiki.
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 12-02-2005, 05:00 AM   #1
medmedia
LQ Newbie
 
Registered: Dec 2005
Distribution: RH 2.4.21-20, RHEL ES Release 3.1
Posts: 18

Rep: Reputation: 0
scheduling problem using 'at'


Hi,

I'm having problems trying to schedule jobs with 'at'. I have setup a test perl script that emails me when it runs, it runs ok from the command line & I receive an email.

If I use 'at' to run it in say 5 minutes, it gets queued correctly, then seems to be processed at the correct time, (ie disappears from the queue), but does not run (ie I don't get an email)

The atd daemon seems to be running ok. Does anyone know where my scripts are going or what log files to look in to investigate? thanks, Al
 
Old 12-02-2005, 05:24 AM   #2
bigrigdriver
LQ Addict
 
Registered: Jul 2002
Location: East Centra Illinois, USA
Distribution: Debian stable
Posts: 5,908

Rep: Reputation: 356Reputation: 356Reputation: 356Reputation: 356
Question: did you make the script executable? It's easy to forget to do that.

To find out if there are any errors in logs, look in /var/log. You'll find several log files there. Some may require root authority to view the files. The first file to look into is 'messages'.
 
Old 12-02-2005, 06:08 AM   #3
medmedia
LQ Newbie
 
Registered: Dec 2005
Distribution: RH 2.4.21-20, RHEL ES Release 3.1
Posts: 18

Original Poster
Rep: Reputation: 0
Thanks, but the script is executable.
I looked in the various log files & can't find any mention of the job there.
I did however notice something strange in the cron log :

LAuS error - do_command.c:226 - laus_attach: (19) laus_attach: No such device
LAuS error - do_command.c:175 - laus_log: (19) laus_log: No such device

These errors appear after every cron entry, the cron jobs are running fine though?
 
Old 12-02-2005, 08:35 AM   #4
medmedia
LQ Newbie
 
Registered: Dec 2005
Distribution: RH 2.4.21-20, RHEL ES Release 3.1
Posts: 18

Original Poster
Rep: Reputation: 0
Finally! I noticed that I had some strange messages in the cron log like:

LAuS error - do_command.c:226 - laus_attach: (19) laus_attach: No such device

I found a fix for that (see below) & it has also fixed my scheduling problem, scripts run fine now from at.

Edit /etc/modules.conf and add "alias char-major-10-224 off" (if the line has it on, then change it to off).

Then do the following steps as root:

service crond stop
service atd stop
rmmod audit
service crond start
service atd start
 
Old 12-02-2005, 10:32 AM   #5
nickonick83
LQ Newbie
 
Registered: Dec 2005
Posts: 2

Rep: Reputation: 0
Hi there! I'm getting the same kind of problem. What I'm trying to do is make apache schedule the execution of a script at a certain time by using the "at" command (I do this by giving the "at" command as the argument for shell_exec in php). As did Medmedia, I can also see the job queued for apache by running "atq" as root, and the job also disappears from the queue list at the time it's supposed to have been executed, only the job itself has not been executed. So I tried Medmedia's solution (see above) but first of all, I don't have any problems in my cron log, and second of all, I don't seem to have a modules.conf file. Either it has something to do with my distribution (Fedora Core 3), or I'm running the find command incorrectly (yes, I'm a ), I tried "find / -name modules.conf". However, I get a message with "Subject: Output from your job 30" being sent to user apache in /var/spool/mail/root that tells me "This account is currently not available." (that is, the apache account). Indeed, in my /etc/passwd file, I find an "/sbin/nologin" for apache (more precisely, "apache:x:48:48:Apache:/var/www:/sbin/nologin") and I'm pretty sure it has something to do with that. Now, what I don't get, is why my system would let apache execute a script through shell_exec, but it won't let apache execute this same script through the intermediary of the "at" command. I'm therefore guessing that "at" daemon "atd" is more restrictive than the system it's in (still with me?).
Lately, I tried making apache run a script (with my account as the file's owner but with 777 permission) which executes the "at" command which executes the concerned script. My idea was that seeing that the owner of the script was my account, maybe it would execute the script as my account and therefore run the "at" command as my account... but that doesn't seem to be the case.

Therefore, is there a .conf file for "atd" where I could make it not so restrictive for apache, or is there no hope for an "/sbin/nologin" account to execute a script through "at"??? Maybe there's a way to go around the problem by executing the "at" command by "sudo"ing with an account that is NOT /sbin/nologin???

Thanks in advance
 
Old 12-02-2005, 10:53 AM   #6
medmedia
LQ Newbie
 
Registered: Dec 2005
Distribution: RH 2.4.21-20, RHEL ES Release 3.1
Posts: 18

Original Poster
Rep: Reputation: 0
Hi,

you could try using

# locate modules.conf

instead of find.

I have a feeling that you might be right about the apache user, mine is set to /bin/bash in the passwd file.

Can you run the script logged in as root ? eg.

at now + 2 minutes -f your_script.sh

cheers,
Al
 
Old 12-02-2005, 11:07 AM   #7
medmedia
LQ Newbie
 
Registered: Dec 2005
Distribution: RH 2.4.21-20, RHEL ES Release 3.1
Posts: 18

Original Poster
Rep: Reputation: 0
Hi,

Also forgot to mention that two system files, /etc/at.allow and /etc/at.deny, control access to the at utility.

These are the rules:

1. If /etc/at.allow does not exist and /etc/at.deny does not exist then only root has access to 'at'.

2. If /etc/at.allow exists, only users listed in /etc/at.allow have permission.

3. If /etc/at.allow does not exist and /etc/at.deny exists, all users have permission except those listed in /etc/at.deny. (at.deny can be empty and still exist - ie 0 bytes)

hope this helps,
Al
 
Old 12-05-2005, 04:10 AM   #8
nickonick83
LQ Newbie
 
Registered: Dec 2005
Posts: 2

Rep: Reputation: 0
Hi. Indeed, I also forgot to mention those things. I have the at.deny file but not the at.allow file. Furthermore, the at.deny file is empty, so everyone has access to the command, and that's another reason for which I'm surprised it's not working.
Concerning the modules.conf file, this is what I get when I execute locate modules.conf (same output when logged as a normal user or root):
/etc/gnome-vfs-2.0/modules/ssl-modules.conf
/etc/gnome-vfs-2.0/modules/default-modules.conf.with-menu-editing
/etc/gnome-vfs-2.0/modules/default-modules.conf
/etc/gnome-vfs-2.0/modules/mapping-modules.conf
/usr/share/man/fr/man5/modules.conf.5.gz

I'm pretty sure none of these files correspond to the file you were talking about. I guess I could change the passwd file and change /sbin/nologin to /bin/bash for the user apache, but wouldn't this be a significant security leak? On the other hand, apache is able to execute shell commands through shell_exec() even with the passwd file set to /sbin/nologin, so would it really change the level of security?

Thank you!
 
  


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
Apache/PHP: Executing 'at' scheduled jobs? bomix Linux - Software 11 01-23-2009 01:02 PM
linux scheduling problem lordofring Programming 2 08-30-2005 09:08 AM
How to have 'at' daemon start automatically on boot TrulyTessa Linux - Newbie 4 12-13-2004 11:12 AM
Can't access the 'at' symbol nedbenj Linux - Software 2 06-15-2004 10:07 AM
use 'at' to run x apps? florestan Linux - Software 6 04-14-2003 03:18 PM

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

All times are GMT -5. The time now is 03:22 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
Open Source Consulting | Domain Registration