Limiting Reseller and User Level Backup to only be able to run at specific times

gnex

Verified User
Joined
Oct 1, 2012
Messages
10
Hello,

1. I want limit backup time between 20:00 (8:00 PM) and 9:00 (9:00 AM). I following this http://help.directadmin.com/item.php?id=273

But this doesn't work when I put 20 and 9 - work only if in first is ex. 1 and in second 9..

if [ "$MAKINGBACKUP" -eq 1 ]; then
if [ "$HOUR" -ge 20 ] && [ "$HOUR" -lt 9 ]; then
//this is a valid time, exit.
exit 0;

Anyone can help me with this? :)

2. How to put 2 bash scripts in all_pre.sh file?
 
For that you may use logics like:
Code:
if [ "$MAKINGBACKUP" -eq 1 ]; then
	if [ "$HOUR" -ge 20 ]; then
		//this is a valid time, exit.
		exit 0;
	elif if [ "$HOUR" -ge 0 ] && [ "$HOUR" -lt 9 ]; then
		//this is a valid time too, exit.
		exit 0;
	.....

You may put the contents of the 2 in 1 file. Just make sure it doesn't exit before executing the second one. Another way to do that is to put that 2 bash scripts somewhere on the system and then call them from all_pre.sh (2 lines of code).
 
Back
Top