OMV 7 run a command at startup

  • Upgrade from OMV4 32 to OMV 7 64 issues


    using the OMV gui scheduled tasks

    I cant see an option to run a scheduled task at startup or reboot in gui

    I am wanting to run two commands:

    sh -c 'vbetool dpms off; read ans; vbetool dpms on' &

    which should turn off my eeepcs backlight and wait for keyboard press - not perfect as only runs once

    and

    hdparm -S 180 /dev/sda

    hdparm -S 180 /dev/sdb

    to have my disks spin down when not in use.


    I have gleaned that system uses apticron and not cron and cron jobs are stored in alternate place

    even knowing how to add jobs outside of gui with apticron would be helpful as have ssh up and running


    thanks for any help

  • KM0201

    Hat das Thema freigeschaltet.
  • Thanks for the suggestion - I entered each command as a seperate scheduled task as I was not sure about writing a script if it would run.


    Problem 1

    How to i check if it was actioned? When I rebooted the system I was sure that the backlight command was not run - nothing changed - so I presume all commands were not run.


    Problem 2

    I have is that the 4 drive devices sda,sdb,sdc,sdd are random - one is a card which will fail

    Plus the commands do not run when I reboot the server - any advice on how to change "at reboot" - this only appeared after I had created a timed entry then I could change it to "at reboot"


    I would prefer to run a script if possible?


    see here:

    [SOLVED|hdparm] HDDs spindown after 10 sec, ignoring hdparm -S setting / Kernel & Hardware / Arch Linux Forums


    Solution was:

    Code
    ACTION=="add|change", KERNEL=="sd[a-z]", ATTRS{queue/rotational}=="1", RUN+="/usr/bin/hdparm -B 128 -S 180 /dev/%k"

    But being noobie I am not sure where to put this in OMV 7? The above code is from ArchLinux


    Any help most welcome! Thanks.

    • Offizieller Beitrag

    If you want to schedule the execution of a script you can do so by specifying the full path to the script, and make sure that the file has execution permissions.


    I'm not sure about this, I'd have to check, but it's possible that the scheduled tasks "restart" option only runs if there is a reboot, but not if the server is started from the shutdown state.

    • Offizieller Beitrag

    Why do you want to use hdparm? It has been removed in OMV7 and smartmontools is used instead to configure AAM, APM and whatever for physical disks. There is a UI that allows you to configure that easily per device.

  • Thanks heaps for info above - I think I tried smartmontools and it failed on usb drives connected to the laptop Im using - I run a RAID1 with 2 drives

    but I will retry these now.


    I still would like to be able to run a script after boot up - is there a way to change the crontabs via ssh to do this perhaps? rclocal is deprecated - I dont really want to create a special init unit to run a startup script if I dont have to.


    Thanks again for the helpful suggestions above.

Jetzt mitmachen!

Sie haben noch kein Benutzerkonto auf unserer Seite? Registrieren Sie sich kostenlos und nehmen Sie an unserer Community teil!