Zum Ende der Metadaten springen
Zum Anfang der Metadaten

If you need to create your own cronjob on LoxBerry (to schedule your own scripts).

Using LoxBerry's own schedules

LoxBerry delivers with a hand-full of directories with fixed schedules:

  • /opt/loxberry/system/cron

The directory has folders e.g. cron.05min, cron.30min, cron.daily etc. It's script content is called in the appropriate schedule.

To schedule your script with that directories, keep the following in mind:

  • The script is not allowed to have a file extension (myscript instead of myscript.sh)
  • The script needs to have a correct shebang (e.g. #!/bin/bash or #!/usr/bin/php)
  • The script needs UNIX linebreaks (if you create your script in Windows, use Notepad++ and use the menu item Edit/Format Line Ending/UNIX.
  • The script's owner needs to be loxberry (chown loxberry:loxberry <filename>) and is executed as loxberry. It has no root permissions!
  • The script needs execute permission (chmod +x <filename>).
  • Don't name the script as a plugin is called. A plugin may overwrite your script if it uses the same name.

The content of the file is the script, not a cron schedule!

Using own cronjob schedule (allows root execution)

Do not use crontab -e as root to create a cronjob. This job will be lost after a reboot.

Cronjobs on LoxBerry are placed in:

  • /opt/loxberry/system/cron/cron.d

The files are crontab schedules including the user:

SHELL=/bin/sh
PATH=/usr/local/sbin:/usr/local/bin:/sbin:/bin:/usr/sbin:/usr/bin
MAILTO=""
# m h dom mon dow user  command
00 00 */1 * * loxberry /opt/loxberry/bin/plugins/lbbackup/runbackup.pl type=DDZ scheduled=true > /dev/null 2>&1

Without the MAILTO="" directive, every output of the script is sent by email. On testing, comment out the directive to get messages (possibly error message).

To schedule your script inside cron.d, keep the following in mind:

  • As this is a system-wide crontab, in the schedule the user root or loxberry must be defined. 
  • The schedule is not allowed to have a file extension
  • The schedule needs UNIX linebreaks (if you create your script in Windows, use Notepad++ and use the menu item Edit/Format Line Ending/UNIX.
  • The schedule file owner needs to be root (chown root:root <filename>) and is executed as root. If your permissions differ, the task is not executed and you may get warning emails.
  • The script needs exactly the following permission: chmod 755 <filename>). If your permissions differ, the task is not executed and you may get warning emails.
  • Don't name the script as a plugin is called. A plugin may overwrite your schedule if it uses the same name.


The content of the file is a crontab schedule, not a script!

Use Google for help on creating crontab files.

Own scripts on LoxBerry

Keep also in mind, that LoxBerry Update will delete all scripts inside the /opt/loxberry directory, that are not part of LoxBerry or it's plugins. Use the legacy folder, or keep your scripts outside of /opt/loxberry.

But cronjobs/scripts in /opt/loxberry/system/cron.xxx are not deleted by LoxBerry Update. 

See also 

Eigene Webseiten und Scripte am LoxBerry betreiben

  • Keine Stichwörter