maemo.org - Talk

maemo.org - Talk (https://talk.maemo.org/index.php)
-   General (https://talk.maemo.org/forumdisplay.php?f=7)
-   -   cron anyone? (https://talk.maemo.org/showthread.php?t=6016)

convulted 2007-04-26 18:40

cron anyone?
 
Still under testing. Straight compile (almost) from Debian repositories. I will post on maemo garage as soon as I figure out how to :-)
The only thing left to do is to get it to run via an rc2.d/ script.
Any comments? Please PM me for the tarball.

convulted 2007-04-26 18:47

Re: cron anyone?
 
Stupid me. I just had to make a link in the rc2.d/ directory. Seems to work like a charm. Any takers?

*edit*

Oh, and crontab is included too :-)

mzandrew 2007-04-27 01:17

Re: cron anyone?
 
I'm very interested. You beat me to the port (still finishing a semester of school). It works well?

SeRi@lDiE 2007-04-27 03:47

Re: cron anyone?
 
I am up for the task :)

rcull 2007-04-27 05:44

Re: cron anyone?
 
I'll Bite your hand off.

rick

convulted 2007-04-27 07:37

Re: cron anyone?
 
@ mzandrew: I'm doing my final year at university :-) And it seems to work without any problems.

So here it is:
http://www.anomaly-music.com/cron/

Read the README, download the .tar.gz and follow the instructions!

mzandrew 2007-04-27 17:50

Re: cron anyone?
 
I installed it and it doesn't seem to run my cron jobs. I'm a bit rusty on crontabs, so forgive me if it's my fault.

On my desktop machine, this runs all the scripts in /etc/cron.hourly every hour on the hour:
Code:

01 * * * * root run-parts /etc/cron.hourly
and the same line on my 770 does nothing. I have a script called "touchy" in each /etc/cron.hourly that simply touches a file in the root directory so that I can easily tell whether it's working.

Since there's no /var/log/messages on my 770, I can't even see the error message that cron would be reporting.

What I did: I ran the installer after untarring the file in /root. I didn't reboot after install, I just ran cron. I edited the crontab using crontab -e. I've tried killing cron and re-running it to no avail.

Any ideas anyone?

convulted 2007-04-27 17:56

Re: cron anyone?
 
Try this command:

Code:

* * * * * touch /test
This should touch the file /test every minute, on the minute. It worked for me straight out of the (scratch)box. Try this command, if it works maybe your crontab syntax is rustier than you thought :P (just kidding!)
I am of absolutely no use in crontab syntax... all I know are the very basics. Nevertheless, I use it for some basic tasks on a (badly maintained, admittidely) Linux box I have at home.

*edit*

cron runs as root, so maybe you could/should leave out the "root" part from that statement. As for the run-parts... is that a separate bin or is it interpreted by cron itself (I didn't need to go too much into detail with the cron source to compile it)?

convulted 2007-04-27 18:03

Re: cron anyone?
 
PS: I don't think the 770 has a run-parts script. Save the file at http://examples.oreilly.com/upt3/split/run-parts to the /usr/bin or /bin directory and chmod it to be executable by root (or everyone). Try
Code:

chmod ugoa+x /bin/run-parts
This should do the trick. I'm still unsure about the "root" part, although it is probably good syntax.

mzandrew 2007-04-27 18:53

Re: cron anyone?
 
run-parts is already installed and is executable. It's a symlink to busybox:

lrwxrwxrwx 1 root root 7 Sep 29 2006 /bin/run-parts -> busybox

convulted 2007-04-27 19:11

Re: cron anyone?
 
I tried the following crontab:
Code:

* * * * * root run-parts /1
* * * * * run-parts /2
* * * * * root touch /r1
* * * * * touch /r2

Where /1 had the following script saved (and correctly chmod'ed) as /1/1:
Code:

#!/bin/sh

touch /s1

and /2 had the following script saved (and correctly chmod'ed) as /2/2:
Code:

#!/bin/sh

touch /s2

The results were that every minute, I got a touch'ed /r2 and /s2 but no /r1 and no /s1; i.e.: the "root" part is being interpreted by cron as part of the command.

HTH,
Dre

mzandrew 2007-04-27 19:46

Re: cron anyone?
 
You were right about the username thing. I took out root and it works fine now. crontab syntax was rusty to the max I guess. thanks for the port and for the help.

Code:

20 * * * * run-parts /etc/cron.hourly
works great.

convulted 2007-04-27 19:50

Re: cron anyone?
 
No problem :-)
Next up will be a utility to automatically connect to an available WIFI network. Powered by cron, obviously!

PS: Your syntax seems to have been correct, at least for some versions of cron. But maybe not for this one.

AliasNode 2007-04-27 19:58

Re: cron anyone?
 
I'm a little unclear on this. Will cron wake up an N800 that has gone into sleep mode? Will your example of touching a file every minute prevent an N800 from going into sleep mode?

convulted 2007-04-27 21:02

Re: cron anyone?
 
Although it keeps running in the background (i.e., it still executes what it has to execute), cron does not wake up my 770. I don't have an N800 so I can't say, sorry!

mzandrew 2007-04-28 00:08

Re: cron anyone?
 
Quote:

a utility to automatically connect to an available WIFI network
I was thinking of the same thing.

I need something to automatically sync a couple directories with my desktop machine as long as my 770 is already connected to my home network. It needs iwconfig to get the essid of the current network, but then it's pretty straightforward from there.

An alternate mode would be to connect to any available network in range and sync to the home machine from an external address.

mzandrew 2007-04-28 00:17

Re: cron anyone?
 
Ideally, I could just patch grsync to give it a command-line mode that would sync a particular setup from its config file every now and then with cron. Not a lot of time in the next couple weeks though...

convulted 2007-04-30 12:11

Re: cron anyone?
 
What I could (try to) write is a program that connects to any available WIFI connection (this part is done) and then executes a shell script (this part should be easy to do), passing to it the ESSID of the WLAN via a command argument. If the syncing that you require can be done via the shell, then you can write it up as a script.
The only thing I'm not sure of currently (and I can't check this until this evening) is the following. The WLAN connection drops a few seconds after the program that initiated it quits. If that program forks a process (shell script) and waits for it to terminate before quitting, then I am hopeful that the connection will be kept alive until the quitting of the main program (does this sentence even make sense?).

HTH,
Dre

convulted 2007-04-30 16:17

Re: cron anyone?
 
Here it is (direct link to the binary): http://www.anomaly-music.com/crun/crun
Copy this file to your /usr/bin/ folder and chmod it to be executable (by root I guess), then call it from the crontab, or the command line if so desired. Syntax is:
Code:

crun <program> [arguments]
for example:
Code:

crun wget google.com/index.html
The program will connect to an access point, if this is available, and then run the specified program. Together with cron, the possibilities are endless... :D

I don't have time to write a README file, so please forgive me on this note.

PS: crun = connect/run

---

DISCLAIMER: I am not responsible if your Internet Tablet stops working, gets bricked, collapses to a singularity, or gets attacked by a pack of rabid goats.

mzandrew 2007-05-01 16:13

Re: cron anyone?
 
sweet. What does it do if it's already connected to a wifi network?

convulted 2007-05-01 17:12

Re: cron anyone?
 
It just uses that connection. Jump over to the developer's forum, we're discussing some related ideas over there :)


All times are GMT. The time now is 00:24.

vBulletin® Version 3.8.8