LinuxQuestions.org
Share your knowledge at the LQ Wiki.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Distributions > Slackware
User Name
Password
Slackware This Forum is for the discussion of Slackware Linux.

Notices


Reply
  Search this Thread
Old 01-27-2018, 05:03 PM   #1
linuxbawks
Member
 
Registered: Apr 2013
Distribution: Snuckware
Posts: 240

Rep: Reputation: 17
Cron jobs not happening


This is a freshly built slacker. I dropped in my cron files from my last distro into /etc/cron.d/. Unfortunately they don't run.

Also I don't see a cron service program in the /etc directory.

Is there a step involved in setting up cron? This topic appears to be blank:
https://docs.slackware.com/howtos:software:cron

I installed cronie, but the jobs still don't run. Do I really need cronie? I don't think so as it wasn't installed by default.

Last edited by linuxbawks; 01-27-2018 at 05:33 PM.
 
Old 01-27-2018, 06:12 PM   #2
abga
Senior Member
 
Registered: Jul 2017
Location: EU
Distribution: Slackware
Posts: 1,634

Rep: Reputation: 929Reputation: 929Reputation: 929Reputation: 929Reputation: 929Reputation: 929Reputation: 929Reputation: 929
Quote:
Originally Posted by linuxbawks View Post
This is a freshly built slacker. I dropped in my cron files from my last distro into /etc/cron.d/. Unfortunately they don't run.

Also I don't see a cron service program in the /etc directory.

Is there a step involved in setting up cron? This topic appears to be blank:
https://docs.slackware.com/howtos:software:cron

I installed cronie, but the jobs still don't run. Do I really need cronie? I don't think so as it wasn't installed by default.
Is the crond deamon running? - check with:
Code:
ps ax | grep crond
It is launched from /etc/rc.d/rc.M during the init process

The cron files (make sure they're executable) that you have copied into /etc/cron.d/ should be copied accordingly into:
/etc/cron.daily/ /etc/cron.hourly/ /etc/cron.monthly/ /etc/cron.weekly/

Force crond to reread the configuration file (not really necessary as crond will do it by itself every minute), run as root:
Code:
crontab -e
and exit the vi editor by writing&exiting - type:
Code:
:wq!
 
Old 01-27-2018, 06:28 PM   #3
linuxbawks
Member
 
Registered: Apr 2013
Distribution: Snuckware
Posts: 240

Original Poster
Rep: Reputation: 17
crond wasn't running.

The /etc/rc.d/rc.M has a statement

Code:
/usr/sbin/crond -l notice
but crond doesn't even have a -l switch. I've decided to run crond by hand. I've made the cron files chmod +x but I'm reluctant to move them out of /etc/cron.d/ yet. The jobs still aern't running.
 
Old 01-27-2018, 06:52 PM   #4
Richard Cranium
Senior Member
 
Registered: Apr 2009
Location: McKinney, Texas
Distribution: Slackware64 15.0
Posts: 3,858

Rep: Reputation: 2225Reputation: 2225Reputation: 2225Reputation: 2225Reputation: 2225Reputation: 2225Reputation: 2225Reputation: 2225Reputation: 2225Reputation: 2225Reputation: 2225
Quote:
Originally Posted by linuxbawks View Post
crond wasn't running.

The /etc/rc.d/rc.M has a statement

Code:
/usr/sbin/crond -l notice
but crond doesn't even have a -l switch. I've decided to run crond by hand. I've made the cron files chmod +x but I'm reluctant to move them out of /etc/cron.d/ yet. The jobs still aern't running.
The crond man page disagrees with you about the -l switch. So does the crond executable.

Code:
$ strings /usr/sbin/crond | grep \\-l
/lib64/ld-linux-x86-64.so.2
crond [-s dir] [-c dir] [-t dir] [-m user@host] [-M mailer] [-S|-L [file]] [-l level] [-b|-f|-d]
-l loglevel   log events <= this level (defaults to %s (level %d))
 
Old 01-27-2018, 07:02 PM   #5
keefaz
LQ Guru
 
Registered: Mar 2004
Distribution: Slackware
Posts: 6,552

Rep: Reputation: 872Reputation: 872Reputation: 872Reputation: 872Reputation: 872Reputation: 872Reputation: 872
Quote:
Originally Posted by linuxbawks View Post
crond wasn't running.

The /etc/rc.d/rc.M has a statement

Code:
/usr/sbin/crond -l notice
but crond doesn't even have a -l switch. I've decided to run crond by hand. I've made the cron files chmod +x but I'm reluctant to move them out of /etc/cron.d/ yet. The jobs still aern't running.
The crontab files in /etc/cron.d are system wide, so username has to be present between day of the week and command fields. Sorry if you already knew it, but just in case...
 
2 members found this post helpful.
Old 01-27-2018, 07:20 PM   #6
abga
Senior Member
 
Registered: Jul 2017
Location: EU
Distribution: Slackware
Posts: 1,634

Rep: Reputation: 929Reputation: 929Reputation: 929Reputation: 929Reputation: 929Reputation: 929Reputation: 929Reputation: 929
Quote:
Originally Posted by linuxbawks View Post
crond wasn't running.

The /etc/rc.d/rc.M has a statement

Code:
/usr/sbin/crond -l notice
but crond doesn't even have a -l switch. I've decided to run crond by hand. I've made the cron files chmod +x but I'm reluctant to move them out of /etc/cron.d/ yet. The jobs still aern't running.
You should launch crond as it is launched in /etc/rc.d/rc.M and it has a -l switch, run man crond:
Quote:
-l loglevel
log events at the specified, or more important, loglevels. The default is `notice'. Valid level names are as described in logger(1) and sys-
log(3): alert, crit, debug, emerg, err, error (deprecated synonym for err), info, notice, panic (deprecated synonym for emerg), warning, warn
(deprecated synonym for warning).
If you run crontab -e , as I suggested in my previous post, you'll notice that in the crond configuration file the scripts found in
/etc/cron.xxxx are executed:

Code:
# Run hourly cron jobs at 47 minutes after the hour:
47 * * * * /usr/bin/run-parts /etc/cron.hourly 1> /dev/null
#
# Run daily cron jobs at 4:40 every day:
40 4 * * * /usr/bin/run-parts /etc/cron.daily 1> /dev/null
#
# Run weekly cron jobs at 4:30 on the first day of the week:
30 4 * * 0 /usr/bin/run-parts /etc/cron.weekly 1> /dev/null
#
# Run monthly cron jobs at 4:20 on the first day of the month:
20 4 1 * * /usr/bin/run-parts /etc/cron.monthly 1> /dev/null
P.S. Just wanted to confirm/point out again what @keefaz mentioned - crond has a per user configuration file and what I instructed you with was regarding the default root usage.
A good lecture:
http://www.unixgeeks.org/security/ne...ix/cron-1.html

Last edited by abga; 01-27-2018 at 07:29 PM. Reason: P.S. + typo
 
Old 01-27-2018, 07:45 PM   #7
upnort
Senior Member
 
Registered: Oct 2014
Distribution: Slackware
Posts: 1,893

Rep: Reputation: 1161Reputation: 1161Reputation: 1161Reputation: 1161Reputation: 1161Reputation: 1161Reputation: 1161Reputation: 1161Reputation: 1161
Quote:
I dropped in my cron files from my last distro into /etc/cron.d/. Unfortunately they don't run.
Quote:
The crontab files in /etc/cron.d are system wide, so username has to be present between day of the week and command fields.
Slackware uses Dillon's cron, which is not the same as Vixie cron or cronie. When copying /etc/cron.d jobs from a distro running Vixie or cronie, then those jobs will contain a user under which to execute the command. Adding a user name in /etc/cron.d jobs with Dillon's cron will cause cron to puke with exit status 127. Check the logs. Removing the user and restarting cron should get everything back to normal.

BTW, unlike other cron daemons, Dillon's cron does not acknowledge dynamic changes in /etc/cron.d. Dillon's cron must be restarted for /etc/cron.d changes to take effect.

Quote:
I installed cronie, but the jobs still don't run. Do I really need cronie? I don't think so as it wasn't installed by default.
If cronie is installed then dcron needs to be removed. Using cronie requires the user account in /etc/cron.d jobs. Dillo's cron does not.
 
1 members found this post helpful.
Old 01-27-2018, 07:52 PM   #8
abga
Senior Member
 
Registered: Jul 2017
Location: EU
Distribution: Slackware
Posts: 1,634

Rep: Reputation: 929Reputation: 929Reputation: 929Reputation: 929Reputation: 929Reputation: 929Reputation: 929Reputation: 929
Just to add, crond stores the conf files (per user) in /var/spool/cron/crontabs/ - it'll create a crontab file with the username as its title.
Since you moved your scripts that cron was executing from your older system/distro, you should have also got the crontab files and put them in /var/spool/cron/crontabs/
Then run crontab -e to make sure crond got them. Alternatively, what I'm usually doing, I'm running crontab -e and I'm copy/paste-ing the old backed up crontab, this way I'm sure that crond will read (update the configuration) and store it correctly in the crontab file.

EDIT > Yup, I wasn't aware that the OP hasn't used Dillon's cron in the first place.

And, @upnort
Quote:
BTW, unlike other cron daemons, Dillon's cron does not acknowledge dynamic changes in /etc/cron.d. Dillon's cron must be restarted for /etc/cron.d changes to take effect.
You don't need to restart crond, just edit its crontab file and it will update by itself the next minute. The best way to do it is with crontab -e ---> this way it'll update instantly. And crond will execute all the modifications that one makes in the /etc/cron.xxxx folders, that are defined in the default root crontab, or any other previously user defined folder, without the need of updating its configuration (crontab -e for instance). It'll execute whatever it finds executable in the defined targets (folders) when the trigger time kicks in.

Last edited by abga; 01-27-2018 at 08:16 PM. Reason: EDIT> change of scope & clarifications
 
Old 01-27-2018, 08:01 PM   #9
keefaz
LQ Guru
 
Registered: Mar 2004
Distribution: Slackware
Posts: 6,552

Rep: Reputation: 872Reputation: 872Reputation: 872Reputation: 872Reputation: 872Reputation: 872Reputation: 872
Quote:
Originally Posted by upnort View Post
Slackware uses Dillon's cron, which is not the same as Vixie cron or cronie. When copying /etc/cron.d jobs from a distro running Vixie or cronie, then those jobs will contain a user under which to execute the command. Adding a user name in /etc/cron.d jobs with Dillon's cron will cause cron to puke with exit status 127. Check the logs. Removing the user and restarting cron should get everything back to normal.
Thanks for the correction! I admit that I never used crontabs in /etc/cron.d. Hopefully your post will help to settle this
 
Old 01-27-2018, 08:13 PM   #10
upnort
Senior Member
 
Registered: Oct 2014
Distribution: Slackware
Posts: 1,893

Rep: Reputation: 1161Reputation: 1161Reputation: 1161Reputation: 1161Reputation: 1161Reputation: 1161Reputation: 1161Reputation: 1161Reputation: 1161
To OP, you can if you want but there is no need to merge the /etc/cron.d files into a root crontab because Dillon's cron is used. Just delete the user from the /etc/cron.d jobs, which likely for all of them will be root. Dillon's cron uses /etc/cron.d just fine. I have been doing that for years with Slackware and do not use a root crontab. I started doing this years ago when I had to support multiple distros and I wanted consistency between systems.

While /var/spool/cron/crontabs is supported with the other cron daemons, in other distros most folks do not use a root crontab for system jobs as is common in Slackware. With other distros /etc/cron.d and /etc/crontab are commonly used.

Quote:
You don't need to restart crond, just edit its crontab file and it will update by itself the next minute.
The crontab command is a per-user command. Dillon's cron will update itself automatically when using the crontab command, but not when modifying /etc/cron.d jobs. The other cron daemons see changes in /etc/cron.d dynamically. Dillon's does not.
 
Old 01-27-2018, 08:57 PM   #11
abga
Senior Member
 
Registered: Jul 2017
Location: EU
Distribution: Slackware
Posts: 1,634

Rep: Reputation: 929Reputation: 929Reputation: 929Reputation: 929Reputation: 929Reputation: 929Reputation: 929Reputation: 929
@linuxbawks
While unport's inputs were very helpful in describing your issue and providing explanations for the alternatives to Slackware's standard crond (Dillon's cron) usage, depending on how confident you are to merge the configuration you've previously had into crond, I'd advise to do so. Some reasons, first I'd like to point out that Slackware uses crond for its housekeeping too and you'd need to merge those tasks into whatever crond alternative you choose, you're on the Slackware Forum looking for help and you'll be better off to get some if you're using the Slackware standard tools and the standard Slackware (old) Dillon's cron is just working fine and easy to use - flexible enough too.

Last edited by abga; 01-27-2018 at 09:02 PM. Reason: typo
 
Old 01-27-2018, 09:25 PM   #12
abga
Senior Member
 
Registered: Jul 2017
Location: EU
Distribution: Slackware
Posts: 1,634

Rep: Reputation: 929Reputation: 929Reputation: 929Reputation: 929Reputation: 929Reputation: 929Reputation: 929Reputation: 929
Quote:
Originally Posted by linuxbawks View Post
This is a freshly built slacker. I dropped in my cron files from my last distro into /etc/cron.d/. Unfortunately they don't run.

Also I don't see a cron service program in the /etc directory.

Is there a step involved in setting up cron? This topic appears to be blank:
https://docs.slackware.com/howtos:software:cron

I installed cronie, but the jobs still don't run. Do I really need cronie? I don't think so as it wasn't installed by default.
Re-reading through your original post and the results that followed your investigation, especially that the crond was not running, the fact that you installed cronie and that you couldn't find the -l switch on crond, leads me to believe that your systems needs some cleaning. Uninstall cronie and check if your default crond (Dillon's cron) is still sane, if not reinstall it and start clean with your cron tasks merger/adaptations.
 
2 members found this post helpful.
Old 01-28-2018, 06:42 AM   #13
55020
Senior Member
 
Registered: Sep 2009
Location: Yorks. W.R. 167397
Distribution: Slackware
Posts: 1,307
Blog Entries: 4

Rep: Reputation: Disabled
Quote:
Originally Posted by linuxbawks View Post
I installed cronie, but the jobs still don't run. Do I really need cronie? I don't think so as it wasn't installed by default.
Be aware [1], cronie conflicts with Slackware's dcron. In other words, if you installed cronie, you will have broken dcron, and if you remove cronie, you will need to reinstall dcron.

[1] https://slackbuilds.org/slackbuilds/.../cronie/README
 
2 members found this post helpful.
Old 12-29-2019, 10:32 AM   #14
ardya
Member
 
Registered: Mar 2006
Distribution: Slackware since 1997
Posts: 89

Rep: Reputation: 18
Dillon's cron and /etc/cron.d/

Quote:
Originally Posted by upnort View Post
Slackware uses Dillon's cron, which is not the same as Vixie cron or cronie. When copying /etc/cron.d jobs from a distro running Vixie or cronie, then those jobs will contain a user under which to execute the command. Adding a user name in /etc/cron.d jobs with Dillon's cron will cause cron to puke with exit status 127. Check the logs. Removing the user and restarting cron should get everything back to normal.

BTW, unlike other cron daemons, Dillon's cron does not acknowledge dynamic changes in /etc/cron.d. Dillon's cron must be restarted for /etc/cron.d changes to take effect.
My experience has shown that new files can be added to /etc/cron.d/ and they ran. However a restart was required after removing files, else they continue to execute as scheduled. Since Slackware doesn't have a separate init script for crond, run:
Code:
ps wwwl $(pgrep crond)
note the PID, then run:
Code:
kill -HUP PID_num
Hopefully others will find this information useful.
 
Old 12-29-2019, 12:17 PM   #15
_peter
Member
 
Registered: Sep 2014
Location: paris
Distribution: slackware
Posts: 314

Rep: Reputation: Disabled
everything has been said in the various replies, your initial help request is puzzling though
Quote:
Originally Posted by linuxbawks View Post
This is a freshly built slacker. I dropped in my cron files from my last distro into /etc/cron.d/. Unfortunately they don't run.
moving your cron root executable files into the appropriate directories should just work as always on a fresh slackware box.
you did move your files inside the proper location ? sorry it's not obvious to me

Code:
/etc/cron.daily/
/etc/cron.hourly/
/etc/cron.monthly/
/etc/cron.weekly/
quite right there is no direct entry for cron on the docs site however this one on scheduling is there https://docs.slackware.com/howtos:ge...ing#using_cron to get the gist of
Code:
crontab -e
as root
 
  


Reply



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
Show/stop currently running cron jobs; enable/disable jobs in various crontabs leniviy Linux - Software 1 10-27-2017 05:59 AM
Cron Jobs randhir Linux - Newbie 5 03-04-2016 06:49 AM
Cron job starts 6 hours late, rest of cron jobs work fine pieterhouwen Linux - Newbie 33 10-05-2015 12:38 PM
Where are cron jobs located when not under /var/spool/cron/root? NotionCommotion Linux - Newbie 6 09-07-2012 07:33 AM
cron hourly, daily, cron.d jobs don't execute eggsmartha Linux - General 3 09-17-2007 06:37 PM

LinuxQuestions.org > Forums > Linux Forums > Linux - Distributions > Slackware

All times are GMT -5. The time now is 05:45 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