Hello,
I am running a dedicated proxmox backup server. All backup clients are configured to run their backups once per week at around 11am of sunday as this is the time, where almost no user activity is active. Consequently the backup server does not need to run during the week between Monday and Saturday. I try to configure the backup server to automatically start on sunday morning at 10am and stop after all backup activity is finished. It turned out that this is not as easy as I thought. My server cannot start automatically on every sunday. At least I did not find any way to achieve this. But I came up with a solution to start automatically every day at a given time with this script:
My intention is to run this script every hour by cron. If there is no backup activity going on the pc will power down and is waking up automatically the next day.
There are some problems I could not resolve yet
1. The above script does not work when I run it from cron. I have to run it by hand on the console. Could someone explain how to make it work from cron.
2. I would like to check if there is some backup activity running to prevent the backup server to stop before all activity is done. How could I achieve this?
many thanks for all comments
I am running a dedicated proxmox backup server. All backup clients are configured to run their backups once per week at around 11am of sunday as this is the time, where almost no user activity is active. Consequently the backup server does not need to run during the week between Monday and Saturday. I try to configure the backup server to automatically start on sunday morning at 10am and stop after all backup activity is finished. It turned out that this is not as easy as I thought. My server cannot start automatically on every sunday. At least I did not find any way to achieve this. But I came up with a solution to start automatically every day at a given time with this script:
Code:
#!/bin/bash
# uncomment for debugging
#set -x
# get day of tomorrow
tomorrow=$(date -d"+1 day $1" "+%Y%m%d")
start_time="100000"
start_at=$tomorrow$start_time
# stop pc and start it next day at 10am
rtcwake -m off --date $start_at
My intention is to run this script every hour by cron. If there is no backup activity going on the pc will power down and is waking up automatically the next day.
There are some problems I could not resolve yet
1. The above script does not work when I run it from cron. I have to run it by hand on the console. Could someone explain how to make it work from cron.
2. I would like to check if there is some backup activity running to prevent the backup server to stop before all activity is done. How could I achieve this?
many thanks for all comments