NOTE... This will make this cronjob/systemd service run as root. If you want it to run as a specified user, you must change the service file name to the following "[email protected](user).service", (user) meaning your account name. You must also update the timer file to reflect the new file name.
Make a filed called /etc/systemd/system/cron-radiorecorder.service
[Unit]
Description=Buffas Radio Recorder Service
# The name of the timer that's going to call this service file.
Wants=cron-radiorecorder.timer
[Service]
# Comment out the line below if you want to run it as root.
User=%I
# KISS (Keep It Simple Stupid)
Type=simple
# The actual command that must be called.
ExecStart=/home/recorder http://gcnplayer.gcnlive.com:80/channel3-hi.mp3 paulparent /home/recorder/ 14400
[Install]
WantedBy=basic.target
Next make the file called /etc/systemd/system/cron-radiorecorder.timer
[Unit]
Description=Buffas Radio Recorder Job
[Timer]
# To add a time of your choosing here, please refer to systemd.time manual page for the correct format
OnCalendar=Sun *-*-* 06:00:00
# Persistence=true since this script is going to be called every week for life.
Persistent=true
# The name of the actual service must be specified since it contains the command to be run.
Unit=cron-radiorecorder.service
[Install]
WantedBy=basic.target
Now to install and enable it...
# Refresh the daemons that systemd can see.
systemctl daemon-reload
# Enable the cron-radiorecorder timer
systemctl enable cron-radiorecorder.timer
# Enable the cron-radiorecorder service
systemctl enable cron-radiorecorder.service
# Start the cron-radiorecorder timer
systemctl start cron-radiorecorder.timer
And that's all folks!
Since the service is created in systemd, the service can be started or stopped at any time by using "systemctl (start/stop) cron-radiorecorder.service". The cronjob/timer can be enabled/disabled and start/stopped doing "systemctl (enable/disable/start/stop) cron-radiorecorder.timer".
Hopefully this will be able to help you.