Zoyinc
  • Home
  • Contact
  • Categories
    • CD Archiving
    • GIMP
    • Linux
    • MythTV
    • Open Media Vault
    • Technology
    • VMware
    • WordPress
    • YouTube
  • About


Scheduling a task in Open Media Vault

By

Tony

,

November 20, 2016

I need to run some scripts every night to move some files around in OMV. I want something that simple and easy to maintain and more or less stock standard.

There are probably many variations on how this could be done but this is how I chose to do it.

Before we start it is worth noting I have my RAID mounted by OMV at:

/media/f20b47a4-d207-40aa-a7e6-42ea82354455

1. Ensure you have enabled home directories for users. I created a shared folder called “/home” and  enable this in “Access Rights Management | Users | Settings”:

Users Settings

2. Create a user called “scheduledtasks” and make a member of the groups as all your other users. As a result this user should have a home directory along the lines of:

/media/f20b47a4-d207-40aa-a7e6-42ea82354455/home/scheduledtasks

3. Create a shared folder called “scheduled_jobs”, I would also add this as a windows/smb shared folder.
4. In this folder create a simple shell script:

#!/bin/sh
echo "Running script /scheduled_jobs/test.sh"
5. Create a scheduled task with a command of:

bash ~/../../scheduled_jobs/test.sh

Scheduled task

6. Once you have saved the task click on the “Run” button to show the dialog to “Execute cron job” – click on “Start”. It should return “Running script /scheduled_jobs/test.sh”, which is of course the echo command inside the script.

 

When I setup a real task I found that for the types of task I wanted to do, including mounting SMB shares I needed to run it as root. This meant that I needed to specify the full path to my RAID drive. Thus my scripts started like:

#!/bin/sh
#
# Script to archive appropriate folders
# to the Archive folder.
#
# Tony Paterson
# May 2007
#
RAIDRoot="/media/f20b47a4-d207-40aa-a7e6-42ea82354455"

# Source function library.
if [ -x /etc/rc.d/init.d/functions ]; then
. /etc/rc.d/init.d/functions
fi

#
# Get the date in the format "Day of Week" and time
# This will mean that we will effectively keep a weeks backup
#
SHORTDATE=`date +%a`


#
# User config section
#
ArchiveFolder="${RAIDRoot}/backups/daily/essentials"
LogDir="${RAIDRoot}/backups/daily/logs"
LOGFILE="${LogDir}/backup_essentials.log"

#
# archive folder exists
#
echo "Creating Backup Directory..."
echo "Creating Backup Directory..." >> $LOGFILE
su - root -c  "rm -Rf ${ArchiveFolder}"
su - root -c  "mkdir -p -v  ${ArchiveFolder} "

 

Related

Replacing a system disk in Open Media Vault
Installing Open Media Vault
Open Media Vault
Open Media Vault FAQs and tips
Recent

  • AlmaLinux GUI – no taskbar or application shortcuts

    AlmaLinux GUI – no taskbar or application shortcuts

  • AlmaLinux 9.5 base VM

    AlmaLinux 9.5 base VM

  • Reset Kodi thumbnails

    Reset Kodi thumbnails

  • Set default settings values in Kodi skins

    Set default settings values in Kodi skins

  • Add/Remove/Reset music/video libraries in Kodi

    Add/Remove/Reset music/video libraries in Kodi

  • Zoyinc Kodi skin on Sony TV

    Zoyinc Kodi skin on Sony TV

  • [L] – WordPress UAM Locked Post

    [L] – WordPress UAM Locked Post

  • Import Pictures and Videos – images not previewed

    Import Pictures and Videos – images not previewed

  • Find My Train

    Find My Train

  • WordPress style name not visible

    WordPress style name not visible

About Zoyinc

  • Contact Us
  • Zoyinc Disclaimer
  • Google Search Console
  • Privacy Policy
  • Site Statistics
  • Login

Apache Auckland Backup CD CentOS Centos7 Children Configuration Debian Error ESX ESXi Fedora Firewall Install Josh Kids Kodi Linux MariaDB MySQL MythTV New Zealand OKD OMV Open Media Vault OpenShift PHP Player Python RAID RedHat Red Hat Rip School Setup SMB SonicWALL Spark tags Train Trains VLAN VM VMware Weaver Windows WordPress YouTube

Powered by

This site is licensed under a Creative Commons Attribution 4.0 International License.