You are not logged in.

#1 2011-02-13 22:26:38

Isola
Member
Registered: 2010-02-02
Posts: 99

[SOLVED] cron's @reboot equivalent in fcron?

This line works in the default cron daemon installed in archlinux:

@reboot screen -dmS rtorrent rtorrent

The above line doesn't work in fcron. It gives me this error when I'm done editing the crontab with `fcrontab -e'

File contains some errors. Ignore [i] or Correct [c] ? Please press c to correct, or i to ignore: c
/tmp/fcr-aGQGMP:2: Error while reading frequency (lower than 10s) : skipping line.

This question is even in the FAQ of fcron:
"How can I emulate a Vixie cron @reboot entry?"

@volatile,first(1) BIG-period /your/command

Which should equal:

@volatile,first(1) BIG-period screen -dmS rtorrent rtorrent

This still gives me the same error:

Error while reading frequency (lower than 10s) : skipping line.

I'm not sure what BIG-period is suppose to do. Is it a time period I should write there instead? @reboot isn't a periodic event in cron, so I guess I would omit the BIG-period part.

That didn't work. I also tried changing "BIG-period" to "never", which also didn't work. I'm out of ideas, I don't know what I'm doing wrong.

Last edited by Isola (2011-02-14 15:26:37)

Offline

#2 2011-02-14 03:12:00

Stebalien
Member
Registered: 2010-04-27
Posts: 1,239
Website

Re: [SOLVED] cron's @reboot equivalent in fcron?

Just out of curiosity, did you write "BIG-period" and "never" verbatim or did you enter a big period of time.


Steven [ web : git ]
GPG:  327B 20CE 21EA 68CF A7748675 7C92 3221 5899 410C

Offline

#3 2011-02-14 04:44:20

Isola
Member
Registered: 2010-02-02
Posts: 99

Re: [SOLVED] cron's @reboot equivalent in fcron?

Stebalien wrote:

Just out of curiosity, did you write "BIG-period" and "never" verbatim or did you enter a big period of time.

I tried writing a time period, like 1 and 1h and 5w1d1h etc. It worked, but it would execute at boot AND after the BIG-period. I want it to be exactly like @reboot. Is there no better way?

Offline

#4 2011-02-14 04:53:39

Stebalien
Member
Registered: 2010-04-27
Posts: 1,239
Website

Re: [SOLVED] cron's @reboot equivalent in fcron?

Based on what the FAQ says, probably not. I think 100 years (1200m) should be long enough.
Edit - Why don't you just use /etc/rc.local?

Last edited by Stebalien (2011-02-14 04:55:53)


Steven [ web : git ]
GPG:  327B 20CE 21EA 68CF A7748675 7C92 3221 5899 410C

Offline

#5 2011-02-14 14:00:05

Isola
Member
Registered: 2010-02-02
Posts: 99

Re: [SOLVED] cron's @reboot equivalent in fcron?

Stebalien wrote:

Based on what the FAQ says, probably not. I think 100 years (1200m) should be long enough.
Edit - Why don't you just use /etc/rc.local?

I know of rc.local. I use it for system specific things - not user specific "sudo something" or "su someone -c something"
For example one system has this network card by Marvel/Yukon, and sometimes it is brought up at 100mbit instead of 1Gbit, so I have a loop in /etc/rc.local to make sure it is 1Gbit.
Another example is  mount --bind /some/long/dir/ /shortcut - if this dir isn't available when /etc/fstab is parsed.

Currently my crontab consist of 4 entries with @reboot - and I change it pretty often - and it has to be on several systems. Appending to rc.local is one option, but it's to much of hassle when I have to change ~10 different rc.locals on different systems.

Anyway, a frequency of 100 years should be more than enough! I guess something like:

@bootrun(1) 100y pidof rtorrent || screen -dmS rtorrent rtorrent

Would work pretty well for a single user system.

Offline

#6 2011-02-14 14:19:36

Stebalien
Member
Registered: 2010-04-27
Posts: 1,239
Website

Re: [SOLVED] cron's @reboot equivalent in fcron?

For the network card, you should take a look at writing udev rules.
For the autostart, you could try something like this in your rc.local.

for user in /etc/startup.d/*; do
    user=$(basename file)
    if [ $(stat -c %u $file) -eq $(id -u $user) ]; then
        su -c "$file" - $user
    else
        echo "Wrong permissions on $file" >&2
    fi
done

Steven [ web : git ]
GPG:  327B 20CE 21EA 68CF A7748675 7C92 3221 5899 410C

Offline

#7 2011-02-14 15:23:18

Isola
Member
Registered: 2010-02-02
Posts: 99

Re: [SOLVED] cron's @reboot equivalent in fcron?

Hmm... something like that would work too - but a crontab is simpler. I try to keep as much as possible within the permissions of a user, so I don't have to go root (if I have access to it in the first place).

Offline

Board footer

Powered by FluxBB