LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Slackware (https://www.linuxquestions.org/questions/slackware-14/)
-   -   Crond is stubborn... (https://www.linuxquestions.org/questions/slackware-14/crond-is-stubborn-201215/)

Worstje 07-05-2004 01:29 AM

Crond is stubborn...
 
Hello all,

Ever since installing crond I have had the problem that unless I restart it manually as root, it is not cronding anything :(. After killing and starting it manually everything works though... Had to restart the other day and well... it's pretty annoying when your alarm doesn't go off anymore (yup Slackware has 1001 uses :D).. I restart crond exactly the same way as it appears in ps.

Anyone got any clue as to the cause of this problem?

Thanks :)

keefaz 07-05-2004 04:54 AM

How do you add a cron for your user ?

bender647 07-06-2004 04:36 PM

Same symptoms here
 
I have three perfectly working slack servers, save for this exact same problem.
Crond runs at startup, it even writes to the log saying it did the run-parts hourly.
Problem is, the scripts in cron.hourly were not run.

There's no problem with the scripts, if I run them manually they work.

Kill crond and restart as root and it runs perfectly forever (well, 60 days
uptime last count).

I tried the kill cron/restart trick in rc.local, but that doesn't work either.

Still debugging this one!

Worstje 09-09-2004 05:24 PM

@ all:

Sorry I ended up with my school taking all my time and some personal issues. That and my holidays prevented my from getting back to this after all this time. My apologies :)

@ keefaz:

user@box $ crontab -e
and
root@box $ crontab -e user

have both been tried. None of them work until I manually restart crond.

@ bender647:

Have you managed to find a solution yet? I myself am still stumped..

Cedrik 09-10-2004 04:31 AM

I find it curious, I ran slackware 9.1, now 10.0 and has never problem with cron. I add cron for user like you (crontab -e).

could you post your crontab -l for this user ?

Worstje 09-11-2004 05:43 PM

Well I tried it with a few users, but my original testcase is following:

Code:

coresausage ~ # crontab -l stereo
# Every mon-fri at 7am, wake up call!

#0 7 * * mon-fri /usr/local/bin/alsaplayer /music/force\ and\ styles\ -\ field\ of\ dreams.mp3 1> /dev/null
0 6 * * mon-fri /music/scripts/easyplay 100 -q /music/force\ and\ styles\ -\ field\ of\ dreams.mp3 1> /dev/null

Nothing is wrong with the script, it works fine started manually. Or after I have restarted crond after booting my box 'ofcourse'.

Cedrik 09-12-2004 02:36 AM

Maybe a tip (or not)

As you indicated the days in plain text, it may be a problem with your locale ?

Did you try 1-6 instead of mon-fri ?

Also from man 5 crontab, it say that name interval does not work, it should be number so : 1-6

Worstje 09-12-2004 05:06 AM

Thanks, I'll try it now :)

And even though I am dutch, I prefer english anyway :) So probably not a locale problem..

Cedrik 09-12-2004 05:32 AM

hem, I did a mistake for monday to friday, it should be 1-5 ;)

Worstje 09-12-2004 06:09 AM

I noticed lol... but doesn't matter :).

After my last post, I have edited my crontab for this user to look like this:

Code:

coresausage worstje # crontab -l stereo
# Every mon-fri at 7am, wake up call!

#0 7 * * mon-fri /usr/local/bin/alsaplayer /music/force\ and\ styles\ -\ field\ of\ dreams.mp3 1> /dev/null
0 * * * * /music/scripts/easyplay 100 -q /music/force\ and\ styles\ -\ field\ of\ dreams.mp3 1> /dev/null

and next I rebooted. Ever since I have waited. Still am but I am kind of convinced that it's not going to play anymore now (13:09). And running it manually still works fine. :(

Cedrik 09-12-2004 06:46 AM

0 * * * * : means 13:00 - 14:00 - 15:00 ...

you want to test cron ? try this :
on a terminal type :
tty

say current tty is /dev/pts/135

crontab -e
* * * * * date > /dev/pts/135

save and look at your terminal

Worstje 09-12-2004 07:55 AM

Hmm weird.. I just used your tactic to test, and it seems crond is indeed doing its job like it should... But somehow, my script doesn't want to play the music, while it does when I am logged in as a certain user... Contents of easyplay script are following:

Code:

#!/bin/sh
#
# Parameter 1 is volume in percent,
# parameters 2+ are given to alsaplayer.
#
# Primarily to keep crontabs clean when using them.
# Will afterwards restore master volume to what it was
# set to before starting the script.
#

OVOLUME=$(amixer sget Master | egrep -m 1 -o "\[[0-9]{1,3}%\]" | egrep -o "[0-9]{1,3}")

amixer sset Master $1% &>/dev/null

shift;

alsaplayer "$@"

amixer sset Master $OVOLUME% &>/dev/null

Is something wrong with this code? If so, why does it just work when calling it from the CLI, and not from crond?

EDIT: And why does it suddenly work when I restart crond manually?

I appreciate all the help.. :)

Cedrik 09-12-2004 08:04 AM

first I would check mail to see if errors are logged :
mail

second, I would try :
Code:

*/3 * * * * /music/scripts/easyplay 100 -q '/music/force and styles - field of dreams.mp3' 1> /dev/null
so script will be run every 3mn and the mp3 name is quoted, but I suggest you to make a copy of this file with no spaces in it.

Worstje 09-12-2004 08:16 AM

I don't have mail for root or the stereo user.

Second, your script is not working either... for as far I can tell anyway.. Running it manually in the CLI works ofcourse... For as far I know my stereo user has all the permissions to play music...

I really appreciate your quick replies :) You don't see that often.. Thanks again!

Cedrik 09-12-2004 08:20 AM

Don't have mail ? Not a problem, we can log error in file ;)
say at /home/stereo/logfile

But please try to cpy the mp3 without spaces in its name as the problem may come from that.

Code:

*/3 * * * * /music/scripts/easyplay 100 -q '/music/force and styles - field of dreams.mp3' >> /home/stereo/logfile 2>&1


All times are GMT -5. The time now is 01:36 AM.