script .sh not working as expected/What am I doing wrong?

@reboot root /bin/bash .local/share/script/fan_script.sh > /dev/null 2>&1
While you told cron where to find bash using an absolute path, ".local/share/script/fan_script.sh" is still a local/relative path. Try "@reboot root /bin/bash /root/.local/share/script/fan_script.sh", with a heading "/" = a "full path" if ".local/" is inside of "/root/"...

Good luck :)
 
Last edited:
Hi UdoB,

Thanks for your reply.
I changed the line in crontab, but it is not working.

And indeed, .local is inside of root.
Changed the line in cron to @reboot root /bin/bash /root/.local/share/script/fan_script.sh

when I execute: "run-parts /etc/cron.daily" nothing happens

Is it maybe that cron will not force execute because it is a "@reboot" command?

If I enter: "/root/.local/share/script/fan_script.sh" script is working fine
 
Last edited:
when I execute: "run-parts /etc/cron.daily" nothing happens
That's a different approach ;-)

Just put your script there. Or link it like ~# ln /root/.local/share/script/fan_script.sh /etc/cron.daily/ . (Note the lack of "-s", I prefer it this way; note the need of a trailing "/" to use the same filename.)

Best regards
 
That's a different approach ;-)

Just put your script there. Or link it like ~# ln /root/.local/share/script/fan_script.sh /etc/cron.daily/ . (Note the lack of "-s", I prefer it this way; note the need of a trailing "/" to use the same filename.)

Best regards
Hi Udo,

I have the script ready in the right place. It needs to be executed after booting up the server. So after a reboot of after a cold boot the script has to run. I just want to test it via crontab if it is working. Otherwise I have to constantly do a reboot of the server to test it.
Is there another approach possible to do this? for example, if I remove @reboot in the cron file and replace it for a command something like "execute it every 10 minutes" (don't know off course if it is possible and what will be the right line in cron file)
After I have checked it and it is woking, I then can replace the line for "@reboot" again in the cron file.

I assume that you have seen already you're dealing with a newbie here.
Maybe I just do not understand
 
I personally use systemd services and timers for this instead of cron. Way more powerful (you can tell it to wait for execution until some requirements are met like filesystems mounted or network available) and you can let it monitor the script. So for example run it once after boot and then monitor its state and auto restart the script once it fails/crashes for some reason in case you need to script to be running 24/7 because it needs to dynamically adjust fans based on the temperatures reported by ilo.
 
Last edited:
  • Like
Reactions: chlowjow

About

The Proxmox community has been around for many years and offers help and support for Proxmox VE, Proxmox Backup Server, and Proxmox Mail Gateway.
We think our community is one of the best thanks to people like you!

Get your subscription!

The Proxmox team works very hard to make sure you are running the best software and getting stable updates and security enhancements, as well as quick enterprise support. Tens of thousands of happy customers have a Proxmox subscription. Get yours easily in our online shop.

Buy now!