cron configuration

Hi,
I am programming a Western Digital ShareSpace network disk system.
I installed a cron from ipkg. (explained here: ShareSpace - Hacking WD MyBook World Ed ShareSpace - Hacking WD MyBook World Ed)

Cron runs:

/etc $ ps -fe | grep cron
 6082 root        616 S < /opt/sbin/cron
18635 root        504 R < grep cron

I have programmed a crontab with a logfile.
The cron does not read my crontab file since the log file does not show a trace of cron.

Is there a way to know which crontab file uses cron? (Where does cron points to?)

Thanks.

Charles.

First off, your user needs to be in the cron group. Add them to the group like this:

usermod -a -G cron username

You must logout and log back into username for the new group to take effect.

Next let's prove that cron is operating properly. Run crontab -e to enter an interactive editor for your cron table.

* * * * * touch /home/username/filename

If cron is working, cron will create the file /home/username/filename and update its timestamp every minute.

See man 5 crontab for further details on how cron entries should be formatted.

If this works, but your logfile thing doesn't, please provide further details on what you're actually doing, i.e. your crontab entries and script files, otherwise we're just guessing.

Thanks, I will try and let you know
Charles.

---------- Post updated 17-01-11 at 08:59 AM ---------- Previous update was 16-01-11 at 09:42 PM ----------

Well it does not work.

The system is a Western Digital ShareSpace network disk with a Linux OS on it. I have already done that work on another WD MyBook disk and I had no problem.

First usermod is not found, I could have install it with ipkg but it is not available.
Then as I work as 'root' I would suspect root is in the cron group.
The cron process is /opt/sbin/cron.
With 'strings' command I find that the crontab is /opt/etc/crontab
The crontab reads:

SHELL=/bin/sh
PATH=/sbin:/bin:/usr/sbin:/usr/bin:/opt/sbin:/opt/bin
MAILTO=""
HOME=/
# ---------- ---------- Default is Empty ---------- ---------- #
* * * * * touch /home/filename
1,5,10,15,20,25,30,35,40,45,50,55 * * * *  root /opt/scripts/rsync_backup

filename is not created by cron
I could run the touch command by hand and it worked of course.

Thanks for your help, I know the system is not standard....
Charles.

If you change crontab without notifying cron it will not pick up any changes. you could try SIGHUP or yust restart the cron process.

The prefered -- at least by this sysadmin :slight_smile: -- method for updating a table is to use the man crontab (linux) command. Not only does it handle allthe pesky notification tasks, it does validate the syntax of the entries.

Even rebooting the system did not do it.
Is there a log that I can install to see what cron does every minutes.
Cheers.
Charles.

---------- Post updated at 01:16 PM ---------- Previous update was at 01:15 PM ----------

By the way I have an ssh issue is this the right thread for that?

With regards to your cron problem - is crond running? The logfile is /var/log/cron, as mentioned in man crond (linux). There are also other configuration files mentioned in man crontab (linux).

Please start a new thread for your ssh issue.

Please try my suggestions the actual way I suggested doing them before declaring that cron isn't working. You're supposed to use the crontab command, not edit files by hand! This will allow it to warn cron that the table's changing, as well as potentially warn you if you have any syntax errors in your crontab that'd prevent it from running.

There may well be additional problems preventing cron from running your script, so I'd also recommend sticking to the 'touch' command until you get that working. One problem at a time. Try calling touch with the absolute path, whatever it may be for your system.

What is your system, anyway? Last time I used ipkg, it was on a wireless router...

No crond is nt running, only cron.
I am quite new to this, I do not know the diff between cron and crond.

$ ps -fe | grep cron
  741 root        608 S   /opt/sbin/cron
18436 root        504 R   grep cron

In the log I have this

$ ls -la /var/log/cron/
drwx------    3 root     root         1024 Jan 14 15:13 .
drwxrwxrwt    4 root     root         1024 Jan 17 11:50 ..
drwx------    2 root     root         1024 Jan 14 15:13 crontabs

 cd  /var/log/cron/crontabs/
$ ls -la
drwx------    2 root     root         1024 Jan 14 15:13 .
drwx------    3 root     root         1024 Jan 14 15:13 ..

---------- Post updated at 05:52 PM ---------- Previous update was at 05:44 PM ----------

My system is a Western Digital 4 disks RAID1 ShareSpace.
It runs Linux.
I am programming a ssh backup system, I also have problem with the rsync public private key stuff.

There is a link to this :mybookworld.wikidot.com/sharespace
I did what they said but since I am stuck with this cron issue.

Does your system not have crontab -e, then?

Is your root user in the cron group, did you check?

etc, etc, etc.

Thanks Corona688.
yes I use crontab -e
there is no cron group available here since usermod is not on the system, neither in ipkg.
Is there a way to check this group permission by hand?

Yes, the method I suggested earlier, checking the contents of the /etc/group file. It is a text file, so it may be possible to edit it manually, if you're very, very careful.

I did not get that message
I try and get this:

$ more /etc/group
root:x:0:
daemon:x:1:
bin:x:2:
sys:x:3:
adm:x:4:
tty:x:5:
disk:x:6:
wheel:x:10:root
utmp:x:43:
staff:x:50:
admin:x:98:admin
nobody:x:99:
ftp:x:14:ftp
users:x:100:
nfsnobody:x:65534:
jewab:x:1000:

What do you recommend?

Hmf... You don't even have a cron group, which makes this awkward. Most of the suggestions I'd make wouldn't apply to your embedded system. Maybe it's not even supposed to have user cron tables.

You could try editing the global /etc/crontab instead of the user ones. Note that its syntax is slightly different than the usual crontab, it takes the usual five time parameters, then the user, then the command, like so:

*/10  *  * * *  root    test -x /usr/sbin/run-crons && /usr/sbin/run-crons

If you have to create the file, be sure to chmod 644 it after, some crons are very picky about what permissions it wants. And you may have to restart the system for it to start using it.

I finally found an error in the log file;
But I don't really know what it means, so I show you the files:
It seems the error in in ssh , not cron.
So I should open a new thread, should not I?
The other problem is that I dont find /home/filename !!!!

$ more /opt/etc/crontab
SHELL=/bin/sh
PATH=/sbin:/bin:/usr/sbin:/usr/bin:/opt/sbin:/opt/bin
MAILTO=""
HOME=/
# ---------- ---------- Default is Empty ---------- ---------- #
* * * * * touch /home/filename
1,5,10,15,20,25,30,35,40,45,50,55 * * * *  root /opt/scripts/rsync_backup
$ more /opt/scripts/rsync_backup
/usr/bin/rsync -avz rsync://192.168.1.2/TEMP /DataVolume
/usr/bin/rsync -avz rsync://192.168.1.2/DOCS /ExtendVolume
 $ tail /var/log/messages
Jan 19 08:30:34 LBadinRAID1 daemon.err inetd[811]: ssh/tcp (2): bind: Address already in use
Jan 19 08:35:01 LBadinRAID1 cron.info /opt/sbin/cron[28636]: (root) CMD (root /opt/scripts/rsync_backup)
Jan 19 08:40:01 LBadinRAID1 cron.info /opt/sbin/cron[28822]: (root) CMD (root /opt/scripts/rsync_backup)
Jan 19 08:40:34 LBadinRAID1 daemon.err inetd[811]: ssh/tcp (2): bind: Address already in use
Jan 19 08:45:01 LBadinRAID1 cron.info /opt/sbin/cron[29180]: (root) CMD (root /opt/scripts/rsync_backup)
Jan 19 08:50:01 LBadinRAID1 cron.info /opt/sbin/cron[29453]: (root) CMD (root /opt/scripts/rsync_backup)
Jan 19 08:50:34 LBadinRAID1 daemon.err inetd[811]: ssh/tcp (2): bind: Address already in use
Jan 19 08:55:01 LBadinRAID1 cron.info /opt/sbin/cron[29724]: (root) CMD (root /opt/scripts/rsync_backup)
Jan 19 09:00:34 LBadinRAID1 daemon.err inetd[811]: ssh/tcp (2): bind: Address already in use

I repeat: /etc/crontab has a different syntax than the user crontab. There's one more field, after the time fields -- the username to run the program under. Since you forgot the username, you're not telling it to run 'touch filename', you're telling it to run 'filename' under the user 'touch'!

I think you should run touch /tmp/filename anyway. /home/ might be in internal flash ROM for an embedded system, and you don't want to overwrite internal flash any more than you have to -- it's got a way more limited number of write cycles than your average USB flash drive. But /tmp/ is probably a ramdisk.

So:

* * * * * root touch /tmp/filename