What's new

Cron different to usual Linux cron?

  • SNBForums Code of Conduct

    SNBForums is a community for everyone, no matter what their level of experience.

    Please be tolerant and patient of others, especially newcomers. We are all here to share and learn!

    The rules are simple: Be patient, be nice, be helpful or be gone!

Alek

Occasional Visitor
Hello

Does cron on Merlin WRT work differently to regular cron on Linux? Should entware run fine via cron?

This is what I'm trying to do:
Code:
* * * * * /opt/bin/screen -dmS screenname /tmp/mnt/DiskMount/script.sh >> /tmp/mnt/DiskMount/script_cron.log 2>&1 #lftpsync#

And it doesn't seem to ever run screen.

The following works just fine, so there must be something I'm doing wrong:
Code:
* * * * * touch /tmp/mnt/DiskMount/test
 
Does cron on Merlin WRT work differently to regular cron on Linux?
There is no "regular cron on Linux", we've got busybox's cron and Vixie's cron with different crontab syntax. Both available on (almost) any Linux system. Vixie's cron requires user name in crontab:
Code:
*/1 * * * * admin /opt/bin/run-parts /opt/etc/cron.1min

Another catch is environment. $PATH is different in SSH console and cron's run-time shell. Writing full paths to binaries in /tmp/mnt/DiskMount/script.sh solves this problem in most cases.
 
there is a lot of things different to normal linux, not sure why routers are coded differently.
 
There is no "regular cron on Linux", we've got busybox's cron and Vixie's cron with different crontab syntax.

Ah, that explains things. I've not had much occasion to mess with cron.

Still haven't figured out why I can't get it working though. Seems to be getting hung up on the user?

Cron:
Code:
*/1 * * * * Alek /tmp/opt/bin/screen -dmS test >> /tmp/mnt/Ware/cron.log 2>&1 #test#

Error:
Code:
/bin/sh: Alek: not found

Contents of /etc/passwd:
Code:
Alek:x:0:0:Alek:/root:/bin/sh
nas:x:100:100:nas:/dev/null:/dev/null
nobody:x:65534:65534:nobody:/dev/null:/dev/null
Alek:x:500:500:::

Looks like I have to do some reading up on cron tomorrow. Thanks for your help so far @rhyzov_al.
 
there is a lot of things different to normal linux, not sure why routers are coded differently.

Typical Linux distros runs on multi-gigahertz computers, with gigabytes of RAM, and terabytes of disk storage. An embedded device runs on on hundreds of Megahertz, with a few hundreds of megabytes of RAM, and under 1 GB of storage. Therefore they must use cut-down versions of basic tools - typically they will use Busybox to do the job of dozens of different software packages. Some features have to be left out for space/performance reasons.
 
Got it working. I had to specify /bin/sh for screen to run my script, and I'd gotten confused by the different types of cron config. Probably shouldn't have been playing around with Linux CLI hours after undergoing general anaesthetic.
 

Similar threads

Latest threads

Support SNBForums w/ Amazon

If you'd like to support SNBForums, just use this link and buy anything on Amazon. Thanks!

Sign Up For SNBForums Daily Digest

Get an update of what's new every day delivered to your mailbox. Sign up here!
Top