[Plugin] CA User Scripts


Recommended Posts

root@Odin:~# /usr/local/emhttp/plugins/user.scripts/startSchedule.php hourly
bash: /usr/local/emhttp/plugins/user.scripts/startSchedule.php: Permission denied

root@Odin:~# php /usr/local/emhttp/plugins/user.scripts/startSchedule.php hourly
/usr/local/emhttp/plugins/user.scripts/backgroundScript.sh "/tmp/user.scripts/tmpScripts/dynu_updater_hourly/script" >/dev/null 2>&1/usr/local/emhttp/plugins/user.scripts/backgroundScript.sh "/tmp/user.scripts/tmpScripts/pfsense_firewall/script" >/dev/null 2>&1

 

Noticed that I got a permission error in the logs from the User Scripts plugin, it looks like Unraid does not accept the #!/usr/bin/php anymore. I had to add "php" in front of the startSchedule.php in the crontab file to make it work. Can someone test this, I wanna know if it's just my system or a bug/glitch..

Link to comment
  • 2 weeks later...
On 2/27/2024 at 1:25 AM, FlamongOle said:
root@Odin:~# /usr/local/emhttp/plugins/user.scripts/startSchedule.php hourly
bash: /usr/local/emhttp/plugins/user.scripts/startSchedule.php: Permission denied

root@Odin:~# php /usr/local/emhttp/plugins/user.scripts/startSchedule.php hourly
/usr/local/emhttp/plugins/user.scripts/backgroundScript.sh "/tmp/user.scripts/tmpScripts/dynu_updater_hourly/script" >/dev/null 2>&1/usr/local/emhttp/plugins/user.scripts/backgroundScript.sh "/tmp/user.scripts/tmpScripts/pfsense_firewall/script" >/dev/null 2>&1

 

Noticed that I got a permission error in the logs from the User Scripts plugin, it looks like Unraid does not accept the #!/usr/bin/php anymore. I had to add "php" in front of the startSchedule.php in the crontab file to make it work. Can someone test this, I wanna know if it's just my system or a bug/glitch..

Looks like it resolved after a reboot, dunno why or what happened there.

Link to comment

Hi, First post.... I have tried to use crontab inside a VM but it does not seem to run a script I have, run's manually fine. 
I have seen mention of using User Scripts to run commands in docker....e.g docker exec "etc", is there a way to run a script inside a VM on a schedule. I need wake up an SMB share in Proxmox Backup Server VM from a TrueNAS VM on the same Unraid server. I have the fstab built and it remembers it but needs a manual "mount -a" after a reboot to restore the share.
Many Thanks

Link to comment
5 hours ago, GeeMan said:

is there a way to run a script inside a VM on a schedule.

nope, virsh doesnt support this

 

Alternativ, you could run a script which does

 

ssh into your VM and run the command ... either keypair or install sshpass on unraid (unsafe !!!)

 

but rather you should look into your VM why the cron aint running there ... assuming you already did so ;)

  • Like 1
Link to comment

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.