OpenVZ Forum


Home » General » Support » Script to backup groups of vms each day via cron job (Not sure where to put this...)
Re: Script to backup groups of vms each day via cron job [message #50892 is a reply to message #50891] Thu, 21 November 2013 21:15 Go to previous messageGo to previous message
nolageek is currently offline  nolageek
Messages: 4
Registered: July 2013
Location: United States
Junior Member
I've modified the vm-backup.sh so that instead of running the backups, it outputs the value of the different variables that are generated within the script. This is where the problem seems to be:

--- the end of the script looks like this:
echo $DAILY
echo $NUM1
echo $NUM2
echo $TOTAL
vzlist -H -o ctid | sed 's/^[ \t]*//' | sed -n "$NUM1,$NUM2 p"
-------
This is the output when run as cron:
0
1
1
0

This is the output when run as root on the command line:
5
21
26
26
141
142
143
144
145
146

If I hard code the TOTAL value into the script, then it gets the first values, but not the last one.

So, when running in a via cron job, neither of these lines of code in the script are working:

TOTAL=`vzlist -H -o ctid|wc -l`

vzlist -H -o ctid | sed 's/^[ \t]*//' | sed -n "$NUM1,$NUM2 p"



If I put vzlist in a sh file by itself and run it, outputting to a file it doesn't work. Why would that be?
 
Read Message
Read Message
Read Message
Read Message
Previous Topic: NOHZ: local_softirq_pending 100 - is there something to worry about?
Next Topic: Comparison with Docker
Goto Forum:
  


Current Time: Sun Sep 01 18:25:18 GMT 2024

Total time taken to generate the page: 0.05685 seconds