Aïuto ! Can't get a cron script to work

good morning,
I’m calling for help because I don’t understand anything.

I’m trying to trigger a cron script and it’s not working.

First of all, I had to install cronie, because cron was not installed and not in the repositories either.

I double-checked the scheduled time, the script path, the script permissions, to have only absolute paths in the script, and created an output log with an absolute path. Absolutely nothing happens!

I’m thinking of a cron job execution environment problem, but I don’t know where to look,

There are of course systemd units, which work very well, but I would like to test for another environment (pro) where only cron tasks are used.

thanks for your help.

If you created a script like example.sh - made it executable (chmod +x example.sh) - and copied it to e.g. /etc/cron.daily - you may have forgotten:
the file mustn’t have the .sh filename extension?

mv example.sh /etc/cron.daily/example

Just a thought. :wink:

Second:
You may have to install cronie and (start) enable it’s service.

Thank you,

I must be confused, I usually use this syntax in cron
08 15 * * 1-5 /home/falke/Bureau/myscript.sh

I had no access to the crontab until I installed cronie, now I can create a crontab and edit it but you’re talking about another configuration file? I’m at a loss, with all these task schedulers, I need to use the silly, classic crontab :slight_smile:

For crons to be carried out, after installing cronie, cronie.service must be started / enabled like this:

sudo systemctl start --now cronie.service && sudo systemctl enable cronie.service

Enable is needed for it to be carried out on every boot.

(If that’s what you mean by this:)

thanks, well that’s my difficulty, under systemd even cron is considered a service to be started.
My “big” problem I think is to figure out everything that involves starting a systemd service :slight_smile:

Well that should be “solved” by now, I think? You can exchange the service name with just about any other and above commands will work.

The only exception to these are user-space services. They are carried out with the --user argument.

https://wiki.archlinux.org/title/systemd/User#Basic_setup

yes it works and thanks! but there’s something I don’t understand

why do I see two instances?

result of a ps aux :

falke 195274 0.0 0.0 7512 3584 ?        Ss 16:15 0:00 /bin/sh -c /home/falke/Bureau/tst_verif_proprio_et_sauv.sh > /home/falke/Bureau/SauvED.log 2>&1
falke 195275 0.0 0.0 7512 3712 ?        S 16:15 0:00 /bin/bash /home/falke/Bureau/tst_verif_proprio_et_sauv.sh

with this, I’ll be done :slight_smile:

Sorry, this is really hard to read. Can you format code-pastings from your terminal with the code-tool in your post-editor?
(Symbol: </> )

Thanks.

Not sure here. Did you reboot, after enabling the service?

If, not after rebooting your computer - please show the output of this:

‘sudo systemctl status cronie.service’

You did not say, what this user-script you have running twice is all about, how did it get started (potentially twice), etc. - So I’m out of knowledge from within this thread, as you did not explain?

Potentially a misconfiguration in your crontab (I’ve never used crontabs but I always do it in the way I described above in the example)?

:crystal_ball:

systemctl enable --now myservice.service

That will both start the service and enable it so it is auto-started in the future.

2 Likes

You don’t need to reboot to start the cron. You can just start it.

I suppose you could enable it and reboot but there is not real reason to do that. You can just start and enable it.

1 Like

Omg dieses ständiges übersetzen is 'ne echte Strapaze

Since the German subforum will remain, you could also just post there instead of in English. :wink:

(Transl.: Da das deutsche Unterforum bestehen bleibt, könntest Du auch einfach dort schreiben, anstatt auf Englisch. :wink:)

kein pb ich kann Deutsh :slight_smile:

i will consider this post solved.

log fullfits, with errors though due to path interpretation pb…

still to processes still after reboot, maybe du to log redirection…

Thx to you

1 Like

This topic was automatically closed 2 days after the last reply. New replies are no longer allowed.