• If you are still using CentOS 7.9, it's time to convert to Alma 8 with the free centos2alma tool by Plesk or Plesk Migrator. Please let us know your experiences or concerns in this thread:
    CentOS2Alma discussion

Scheduled Tasks / crontab with @reboot

Werring

New Pleskian
I have in crontab for the root user a command that has to run on startup (@reboot).

However, it appears that the Scheduled Tasks manager cant really cope with it.
(whenever i add a task, it gets removed, and i have to use the commandline to add it again.)

is there a way to use @ reboot in root crontab and not make it break by plesk?
 
Yes, You can add new cron on your server under the root user through following command and you can use @reboot

Code:
crontab -e
 
Yes, but whenever i add/update/remove a Scheduled Task through the webinterface of plesk after I added the cronjob with `crontab -e`.
the @reboot job gets deleted.
 
I have now,
but still whenever I add a new task with the plesk panel (after I edited it with crontab -e) it deletes the cronjob.

Example:
Current cron:
Code:
0       1       *       *       1       /opt/psa/libexec/modules/watchdog/cp/secur-check
0       1       *       *       1       /opt/psa/libexec/modules/watchdog/cp/send-report weekly
10      1       *       *       *       /opt/psa/libexec/modules/watchdog/cp/clean-sysstats
15      1       *       *       *       /opt/psa/libexec/modules/watchdog/cp/pack-sysstats day
15      1       *       *       1       /opt/psa/libexec/modules/watchdog/cp/pack-sysstats week
15      1       1       *       *       /opt/psa/libexec/modules/watchdog/cp/pack-sysstats month
15      1       1       *       *       /opt/psa/libexec/modules/watchdog/cp/pack-sysstats year
20      1       *       *       *       /opt/psa/libexec/modules/watchdog/cp/clean-events
0       3       *       *       7       /opt/psa/libexec/modules/watchdog/cp/clean-reports
@reboot /path/to/command

As you can see, my @reboot cronjob has been removed

I go to the tasks page on the panel and disable something (pack-stats year).

Now my cron file looks like:
Code:
0       1       *       *       1       /opt/psa/libexec/modules/watchdog/cp/secur-check
0       1       *       *       1       /opt/psa/libexec/modules/watchdog/cp/send-report weekly
10      1       *       *       *       /opt/psa/libexec/modules/watchdog/cp/clean-sysstats
15      1       *       *       *       /opt/psa/libexec/modules/watchdog/cp/pack-sysstats day
15      1       *       *       1       /opt/psa/libexec/modules/watchdog/cp/pack-sysstats week
15      1       1       *       *       /opt/psa/libexec/modules/watchdog/cp/pack-sysstats month
##      15      1       1       *       *       /opt/psa/libexec/modules/watchdog/cp/pack-sysstats year
20      1       *       *       *       /opt/psa/libexec/modules/watchdog/cp/clean-events
0       3       *       *       7       /opt/psa/libexec/modules/watchdog/cp/clean-reports
        @reboot
 
Well, a boring error, I've never had before in more than ten years of virtuozzo/OpenVZ/KVM. First error at Strato VPS Server with Plesk Onyx on Ubuntu 16LTS.

(at)all: Thanks for your good help.

Situation :

Could not connect by ssh, calling plesk I've got the issued error.

Solution as above in short terms:
  1. Booting in Repair-Mode, going by SFTP or Shell to:
    /repair/var/spool/cron/crontabs/root

  2. Edit the file "root", add the following line after the existing cron tasks:
    @Reboot[/USER] mkdir -p /run/lock/lmlib && chown root:lock-manager /run/lock/lmlib && chmod -R 0770 /run/lock/lmlib

  3. Exit the shell

  4. Reboot in "Normal Mode"

  5. Now call Plesk > Scheduled Tasks

  6. Enter that Cron Task for root, probably you need it only one time:
    */1 * * * * mkdir /var/run/sshd && chmod 0755 /var/run/sshd && /etc/init.d/ssh start

  7. Execute the cron at once or wait a minute

  8. Then try to connect by ssh - READY

  9. Maybe you can deactivate the last mentioned cron task now or set it maybe to repeat after 1 year ;-)
 
Last edited:
Hello,

I want to do a nightly reboot and scheduled a cronjob but it's not working.
probably a wrong command but I can't find a list with possible commands.

Cronreboot.JPG
 
Why are we rebooting things nightly? This isn't some home PC running Windows XP....
 
Back
Top