-
- Influencer
- Posts: 12
- Liked: 10 times
- Joined: Jul 08, 2015 10:19 am
- Contact:
Scripting
Sorry, but I can't find further documentation about the command-line parameters of veeamconfig, and the short help is rather short...
I want to start a job by a script, let's wait the script for ending up the job and then continue.
This would be for:
- mount the destination directoy
- run the backup
- unmount the destination
When running "veeamconfig job start --name FullBackup" the job starts and I am ending up in command line.
How does my script knows when the started job ended?
Maybe you have a sample bash script to to this job?
I want to start a job by a script, let's wait the script for ending up the job and then continue.
This would be for:
- mount the destination directoy
- run the backup
- unmount the destination
When running "veeamconfig job start --name FullBackup" the job starts and I am ending up in command line.
How does my script knows when the started job ended?
Maybe you have a sample bash script to to this job?
-
- Product Manager
- Posts: 5797
- Liked: 1215 times
- Joined: Jul 15, 2013 11:09 am
- Full Name: Niels Engelen
- Contact:
Re: Scripting
Currently you can't add post job scripts but this will be added.
Currently you'll have to monitor the logs for a success or failure.
Currently you'll have to monitor the logs for a success or failure.
Personal blog: https://foonet.be
GitHub: https://github.com/nielsengelen
GitHub: https://github.com/nielsengelen
-
- Veeam ProPartner
- Posts: 156
- Liked: 43 times
- Joined: Oct 28, 2012 6:06 pm
- Full Name: Davide Depaoli
- Location: Santhia' (VC) - Italy
- Contact:
-
- Product Manager
- Posts: 6551
- Liked: 765 times
- Joined: May 19, 2015 1:46 pm
- Contact:
Re: Scripting
Hi,
Here is a piece of code that starts "JobName1" job and waits until it finishes its current session, and then checks its failure/success status:
Here is a piece of code that starts "JobName1" job and waits until it finishes its current session, and then checks its failure/success status:
Code: Select all
veeamconfig job start --name BackupJob1
sessionID=$(veeamconfig session list | grep BackupJob1 | grep Running | awk '{print $3}')
while [[ $(veeamconfig session list | grep BackupJob1 | grep Running) ]]; do
:
done
if [[ $(veeamconfig session list | grep $sessionID | grep Success) ]]; then
echo "Success!"
else
echo "Failed!"
fi
-
- Influencer
- Posts: 12
- Liked: 10 times
- Joined: Jul 08, 2015 10:19 am
- Contact:
Re: Scripting
You did, thanks a lot!davide.depaoli wrote:Hope it can help you.
Seem's like Veeam improved your version now, hope they will spend you a pizza
Just took yours, I placed a "sleep 10" within the while-loop. Don't know if uses more or less cpu this way... Using the sleep indeed my script did not appear in top while waiting.PTide wrote:Here is a piece of code that starts "JobName1" job and waits until it finishes its current session, and then checks its failure/success status:
Works great for me,
thank you both, guys!
-
- Expert
- Posts: 117
- Liked: 31 times
- Joined: Oct 30, 2012 7:53 pm
- Full Name: Chris Jones
- Contact:
Re: Scripting
When scripting for job success you need to make sure you also include the status of WARNING. Jobs can finish with a Success, Failure or Warning status. Warning means the job did complete, but there was an issue with a server, agent or component that should be investigated.
-
- Veeam ProPartner
- Posts: 156
- Liked: 43 times
- Joined: Oct 28, 2012 6:06 pm
- Full Name: Davide Depaoli
- Location: Santhia' (VC) - Italy
- Contact:
Re: Scripting
Hi all,
I have improved the script that launch the backup job and send email with job status. In this version the script tests all exit codes (Success, Warning, Failed) and if the job fails, attach to the email the related job.log file, in order to check what caused the error.
Hope it is useful.
I have improved the script that launch the backup job and send email with job status. In this version the script tests all exit codes (Success, Warning, Failed) and if the job fails, attach to the email the related job.log file, in order to check what caused the error.
Hope it is useful.
Code: Select all
#!/bin/bash
#
# Script to run Veeam backup and email job status
JOBNAME=Backup_to_Cifs
export JOBNAME
TODAY=$(date +"%Y-%m-%d")
export TODAY
veeamconfig job start --name $JOBNAME
until [ -z `pgrep veeamjobman` ]
do
echo "job is running" > /dev/null
done
STATUS=`veeamconfig session list | grep $JOBNAME | grep $TODAY | awk '{print $4}'`
export STATUS
if [ $STATUS = Failed ]
then
LOGDIR=/var/log/veeam/Backup/$JOBNAME/*`veeamconfig session list | grep $JOBNAME | grep $TODAY | awk '{print $3}'`
echo "Job $JOBNAME $STATUS" | mailx -s "VAL session $JOBNAME $STATUS" -a $LOGDIR/Job.log -r VeeamLinuxAgent@mail.local my_email@email.it
else
echo "Job $JOBNAME $STATUS" | mailx -s "VAL session $JOBNAME $STATUS" -r VeeamLinuxAgent@mail.local my_email@email.it
fi
-
- Veeam ProPartner
- Posts: 156
- Liked: 43 times
- Joined: Oct 28, 2012 6:06 pm
- Full Name: Davide Depaoli
- Location: Santhia' (VC) - Italy
- Contact:
Re: Scripting
My code has some bugs. I'm trying to correct errors and add more controls
-
- Product Manager
- Posts: 6551
- Liked: 765 times
- Joined: May 19, 2015 1:46 pm
- Contact:
Re: Scripting
Hi,
In BETA2 pre/post-job scripts have been added thus until [ -z `pgrep veeamjobman` ] is not needed anymore.
In BETA2 pre/post-job scripts have been added thus until [ -z `pgrep veeamjobman` ] is not needed anymore.
-
- Veeam ProPartner
- Posts: 156
- Liked: 43 times
- Joined: Oct 28, 2012 6:06 pm
- Full Name: Davide Depaoli
- Location: Santhia' (VC) - Italy
- Contact:
Re: Scripting
PTide,
I'm just installed BETA but in the gui have not found pre/post script setup. Is there any cli switch to configure this ?
tnx
I'm just installed BETA but in the gui have not found pre/post script setup. Is there any cli switch to configure this ?
tnx
-
- Product Manager
- Posts: 6551
- Liked: 765 times
- Joined: May 19, 2015 1:46 pm
- Contact:
Re: Scripting
If you create a new job then just specify --postjob parameter:
If you'd like to add a post-job script to the job that already exists then just edit the job:
Thanks
Code: Select all
veeamconfig job create --name job1 --objects /dev/sda --reponame Repo1 --postjob /email.sh
Code: Select all
veeamconfig job edit --postjob /email.sh for --name job1
-
- Veeam ProPartner
- Posts: 156
- Liked: 43 times
- Joined: Oct 28, 2012 6:06 pm
- Full Name: Davide Depaoli
- Location: Santhia' (VC) - Italy
- Contact:
Re: Scripting
Ok.
Many thanks
Inviato dal mio ZP999 utilizzando Tapatalk
Many thanks
Inviato dal mio ZP999 utilizzando Tapatalk
-
- Veeam ProPartner
- Posts: 156
- Liked: 43 times
- Joined: Oct 28, 2012 6:06 pm
- Full Name: Davide Depaoli
- Location: Santhia' (VC) - Italy
- Contact:
Re: Scripting
Now it seems to work properly.
This script is intended to be used in crontab instead of the standard VAL schedule, and check:
- if another job is running; if yes, the second job aborts and send an email.
- if the job fails (status Failed) send an email with attached the logfile (Job.log).
- if the job ends successfully with warnings (status Warning) send an email with detail of warnings.
- if the job ends successfully send an email
During my few tests I did not find any malfunction, but I will be happy if someone will want to try and correct or improve it
Here the code.
Now I try to modify it to use as postjob script.
Davide
This script is intended to be used in crontab instead of the standard VAL schedule, and check:
- if another job is running; if yes, the second job aborts and send an email.
- if the job fails (status Failed) send an email with attached the logfile (Job.log).
- if the job ends successfully with warnings (status Warning) send an email with detail of warnings.
- if the job ends successfully send an email
During my few tests I did not find any malfunction, but I will be happy if someone will want to try and correct or improve it
Here the code.
Code: Select all
#!/bin/bash
# Script to run Veeam VAL backup and email job status
JOBNAME=Backup_to_CIFS
export JOBNAME
#TODAY=$(date +"%Y-%m-%d")
#export TODAY
#VEEAM_PID=`pgrep veeamjobman`
#export VEEAM_PID
veeamconfig job start --name $JOBNAME 1> /etc/veeam/scripts/$JOBNAME.tmp 2> /etc/veeam/scripts/$JOBNAME.err
SESSION_ID=`grep ID /etc/veeam/scripts/$JOBNAME.tmp | awk '{print $3}' | sed 's/\[//' | sed 's/\]//' | sed 's/\.//'`
export SESSION_ID
LOGDIR=`grep log /etc/veeam/scripts/$JOBNAME.tmp | awk '{print $4}' | sed 's/\[//' | sed 's/\]//' | sed 's/\.//'`
export LOGDIR
LOGFILE=$LOGDIR/Job.log
export LOGFILE
# check if another job is running
if [ -s $JOBNAME.err ]
then
STATUS=`grep Error /etc/veeam/scripts/$JOBNAME.err`
echo "$STATUS " | mailx -s "VAL session $JOBNAME Error" -r VeeamLinuxAgent@email.local recipient@email.com
veeamconfig job delete --id $SESSION_ID
fi
until [ -z `pgrep veeamjobman` ]
do
echo "job is running" > /dev/null
done
STATUS=`veeamconfig session info --id $SESSION_ID | grep State | awk '{print $2}'`
export STATUS
if [ $STATUS = 'Warning' ]
then
WARN_MSG=`grep "Failed to backup" $LOGFILE | awk '{print $7,$8,$9,$10}' | sed 's/--asyncNtf:--wn://'`
export WARN_MSG
echo "Job $JOBNAME Successful with following $STATUS: $WARN_MSG" | mailx -s "VAL session $JOBNAME $STATUS" -r VeeamLinuxAgent@email.local recipient@email.com
fi
if [ $STATUS = 'Failed' ]
then
echo "Job $JOBNAME $STATUS. See attached logfile for error details" | mailx -s "VAL session $JOBNAME $STATUS" -a $LOGFILE -r VeeamLinuxAgent@email.local recipient@email.com
fi
if [ $STATUS = 'Success' ]
then
echo "Job $JOBNAME $STATUS" | mailx -s "VAL session $JOBNAME $STATUS" -r VeeamLinuxAgent@email.local recipient@email.com
fi
rm -f /etc/veeam/scripts/$JOBNAME.tmp /etc/veeam/scripts/$JOBNAME.err
Davide
-
- Veeam ProPartner
- Posts: 156
- Liked: 43 times
- Joined: Oct 28, 2012 6:06 pm
- Full Name: Davide Depaoli
- Location: Santhia' (VC) - Italy
- Contact:
Re: Scripting
@PTide or any Veeam guy,
I'll need to know if is possible to remove a postjob script from a job. I have following workaround: export val configuration, edit the output file deleting the PostjobCommand (leaving "") and reimport the configuration.
veeamconfig job edit --postjob /email.sh for --name job1
Is there a complementary command to remove postjob ?
tnx
I'll need to know if is possible to remove a postjob script from a job. I have following workaround: export val configuration, edit the output file deleting the PostjobCommand (leaving "") and reimport the configuration.
veeamconfig job edit --postjob /email.sh for --name job1
Is there a complementary command to remove postjob ?
tnx
-
- Product Manager
- Posts: 6551
- Liked: 765 times
- Joined: May 19, 2015 1:46 pm
- Contact:
Re: Scripting
Hi,
Currently that's the only way how you can remove scripts from the job settings. In GA scripts settings will be added to UI also CLI will be extended with extra commands.
Thank you!
Currently that's the only way how you can remove scripts from the job settings. In GA scripts settings will be added to UI also CLI will be extended with extra commands.
Thank you!
-
- Veeam ProPartner
- Posts: 156
- Liked: 43 times
- Joined: Oct 28, 2012 6:06 pm
- Full Name: Davide Depaoli
- Location: Santhia' (VC) - Italy
- Contact:
Re: Scripting
A new attempt to improve the script.
Fixed some cosmetics issues in email body.
Added some veeamconfig commands as variables.
changed the way to catch warning messages for the warning job status.
Added Job Info in the body of email.
I'm hoping that my work is useful to someone.
Davide
Fixed some cosmetics issues in email body.
Added some veeamconfig commands as variables.
changed the way to catch warning messages for the warning job status.
Added Job Info in the body of email.
Code: Select all
#!/bin/bash
# Script to run Veeam VAL backup and email job status
JOBNAME=Backup_to_LocalRepo
SCRIPT_DIR=/etc/veeam/scripts
LOG_DIR=/var/log/veeam/Backup/$JOBNAME
JOB_INFO=`veeamconfig job info --name $JOBNAME`
#start backup job
veeamconfig job start --name $JOBNAME 1> /etc/veeam/scripts/$JOBNAME.tmp 2> /etc/veeam/scripts/$JOBNAME.err
SESSION_ID=`grep ID $SCRIPT_DIR/$JOBNAME.tmp | awk '{print $3}' | sed 's/\[//' | sed 's/\]//' | sed 's/\.//'`
SESSION_LOG_DIR=`grep log $SCRIPT_DIR/$JOBNAME.tmp | awk '{print $4}' | sed 's/\[//' | sed 's/\]//' | sed 's/\.//'`
LOGFILE=$SESSION_LOG_DIR/Job.log
SESSION_INFO=`veeamconfig session info --id $SESSION_ID | grep -v UUID`
# check if another job is running
if [ -s $JOBNAME.err ]
then
ERROR_MSG=`grep Error $SCRIPT_DIR/$JOBNAME.err`
echo "$ERROR_MSG" | mailx -s "VAL Job $JOBNAME Error" -r VeeamLinuxAgent@email.local recipient@email.com
fi
#check if job is running
until [ -z `pgrep veeamjobman` ]
do
echo "job is running" > /dev/null
done
#check and set the exit status of the job
STATUS=`veeamconfig session info --id $SESSION_ID | grep State | awk '{print $2}'`
if [ $STATUS = 'Warning' ]
then
WARN_MSG=`veeamconfig session log --id $SESSION_ID | grep warn | awk '{print $6,$7,$8,$9}'`
echo -e "Job $JOBNAME Successful with following $STATUS:\n\n$WARN_MSG\n\nJOB INFO:\n$JOB_INFO" | mailx -s "VAL Job $JOBNAME $STATUS" -r VeeamLinuxAgent@email.local recipient@email.com
fi
if [ $STATUS = 'Failed' ]
then
echo -e "Job $JOBNAME $STATUS. See attached logfile for error details.\n\nJOB INFO:\n$JOB_INFO" | mailx -s "VAL Job $JOBNAME $STATUS" -a $LOGFILE -r VeeamLinuxAgent@email.local recipient@email.com
fi
if [ $STATUS = 'Success' ]
then
echo -e "Job $JOBNAME $STATUS.\n\nJOB INFO:\n$JOB_INFO" | mailx -s "VAL Job $JOBNAME $STATUS" -r VeeamLinuxAgent@labinf.local davide.depaoli@labinf.it
fi
rm -f $SCRIPT_DIR/$JOBNAME.tmp $SCRIPT_DIR/$JOBNAME.err
Davide
-
- Product Manager
- Posts: 6551
- Liked: 765 times
- Joined: May 19, 2015 1:46 pm
- Contact:
Re: Scripting
Sure it is useful, so many people just want to setup and forget instead of diving into bash scripting that they have never done before.
Thanks for your update!
Thanks for your update!
-
- Novice
- Posts: 5
- Liked: never
- Joined: Jan 24, 2017 3:44 pm
- Full Name: boudjel boudissa
- Contact:
[MERGED] job report by email
hi,
i installed veeam agent for linux on rhel6
backup and restore works great !
i was wondering how can i setup job email reporting ?
i usually setup email report using gmail admin account
much appreciated for your help...
thanks
boudjel
i installed veeam agent for linux on rhel6
backup and restore works great !
i was wondering how can i setup job email reporting ?
i usually setup email report using gmail admin account
much appreciated for your help...
thanks
boudjel
-
- Veeam ProPartner
- Posts: 156
- Liked: 43 times
- Joined: Oct 28, 2012 6:06 pm
- Full Name: Davide Depaoli
- Location: Santhia' (VC) - Italy
- Contact:
Re: Scripting
Hi boudjel38,
you can configure cron to execute the script I wrote (you can see, copy and customize it here).
For example:
0 7 * * * /etc/veeam/scripts/BackupToVBR.sh
is the script pointing backup to VBR server
you can configure cron to execute the script I wrote (you can see, copy and customize it here).
For example:
0 7 * * * /etc/veeam/scripts/BackupToVBR.sh
is the script pointing backup to VBR server
-
- Novice
- Posts: 5
- Liked: never
- Joined: Jan 24, 2017 3:44 pm
- Full Name: boudjel boudissa
- Contact:
Re: Scripting
hi,
yes i am using veeam B&R
actually it works using the email settings within the B&R console
so i prefer to use this integration rather than your script
much appreciated for your help anyway
i would appreciate in the near futur to have this fonctionnality built in with the agent like it is with the windows agent
all the best
boudjel
yes i am using veeam B&R
actually it works using the email settings within the B&R console
so i prefer to use this integration rather than your script
much appreciated for your help anyway
i would appreciate in the near futur to have this fonctionnality built in with the agent like it is with the windows agent
all the best
boudjel
-
- Novice
- Posts: 8
- Liked: never
- Joined: Feb 23, 2017 10:43 pm
- Full Name: Rui Rodrigues
- Contact:
Backup Notification Linux
Hello,
I manage a few dozens of Linux Debian Servers.
I'm making some tests with the latest version available.
I need to receive an email after the backup is made with the resume of the Backup below:
Backup 100% Status: Warning
Summary Data
Duration: 00:05:23 Processed: 9.6 GB (100%)
Processing rate: 32.5 MB/s Read: 9.6 GB
Bottleneck: Target Transferred: 34.5 MB (285.6x)
Time Action Duration
19:40:37 Job BackupJob1 started at 2017-07-25 19:40:37 BST
19:40:37 Preparing to backup
19:40:42 Creating volume snapshot 00:00:01
19:40:43 Starting incremental backup to Repository_1
19:40:55 Backed up sda 9.6 GB at 33.2 MB/s 00:04:58
19:45:53 [warn] Cannot find EFI boot manager utility
19:45:53 Backing up summary.xml 00:00:00
19:45:57 Releasing snapshot 00:00:03
19:46:00 [warn] Processing finished with warnings at 2017-07-25 19:46:00 BST
Is this info in one file only, so that I can attach the info to an email with a script?
If so, where is the location of the log?
I can ony find info very detailed of the backup, in different files.
Every time the BackupJob runs it creates a new folder with log files in it, but I don't need all the information, and Im not able to do a script to read info in a different folder everytime:
/var/log/veeam/Backup/BackupJob1# ls -lat
total 24
drwxr-xr-x 2 root root 4096 Jul 28 15:42 Session_20170728_154205_{20920194-caea-480a-bbe6-aee0db4bc3ee}
drwxr-xr-x 6 root root 4096 Jul 28 15:42 .
drwxr-xr-x 3 root root 4096 Jul 28 14:33 ..
drwxr-xr-x 2 root root 4096 Jul 25 19:40 Session_20170725_194037_{d20f74e4-9ff4-4297-8e92-1face19ebae6}
drwxr-xr-x 2 root root 4096 Jul 21 19:47 Session_20170721_194658_{49a6f90a-bb14-40fa-a864-0310465c9a82}
drwxr-xr-x 2 root root 4096 Jul 21 19:15 Session_20170721_191532_{5c9e048a-39e0-4d84-ad69-2f6465df60a5}
/var/log/veeam/Backup/BackupJob1/Session_20170728_154205_{20920194-caea-480a-bbe6-aee0db4bc3ee}# ls -lat
total 308
-rw-rw-r-- 1 root root 96705 Jul 28 15:48 Job.log
-rw-rw-r-- 1 root root 106287 Jul 28 15:48 Agent.Target.log
-rw-rw-r-- 1 root root 66602 Jul 28 15:48 Agent.Source.log
drwxr-xr-x 2 root root 4096 Jul 28 15:42 .
-rw-rw-r-- 1 root root 28776 Jul 28 15:42 Agent.Repair.log
drwxr-xr-x 6 root root 4096 Jul 28 15:42 ..
I manage a few dozens of Linux Debian Servers.
I'm making some tests with the latest version available.
I need to receive an email after the backup is made with the resume of the Backup below:
Backup 100% Status: Warning
Summary Data
Duration: 00:05:23 Processed: 9.6 GB (100%)
Processing rate: 32.5 MB/s Read: 9.6 GB
Bottleneck: Target Transferred: 34.5 MB (285.6x)
Time Action Duration
19:40:37 Job BackupJob1 started at 2017-07-25 19:40:37 BST
19:40:37 Preparing to backup
19:40:42 Creating volume snapshot 00:00:01
19:40:43 Starting incremental backup to Repository_1
19:40:55 Backed up sda 9.6 GB at 33.2 MB/s 00:04:58
19:45:53 [warn] Cannot find EFI boot manager utility
19:45:53 Backing up summary.xml 00:00:00
19:45:57 Releasing snapshot 00:00:03
19:46:00 [warn] Processing finished with warnings at 2017-07-25 19:46:00 BST
Is this info in one file only, so that I can attach the info to an email with a script?
If so, where is the location of the log?
I can ony find info very detailed of the backup, in different files.
Every time the BackupJob runs it creates a new folder with log files in it, but I don't need all the information, and Im not able to do a script to read info in a different folder everytime:
/var/log/veeam/Backup/BackupJob1# ls -lat
total 24
drwxr-xr-x 2 root root 4096 Jul 28 15:42 Session_20170728_154205_{20920194-caea-480a-bbe6-aee0db4bc3ee}
drwxr-xr-x 6 root root 4096 Jul 28 15:42 .
drwxr-xr-x 3 root root 4096 Jul 28 14:33 ..
drwxr-xr-x 2 root root 4096 Jul 25 19:40 Session_20170725_194037_{d20f74e4-9ff4-4297-8e92-1face19ebae6}
drwxr-xr-x 2 root root 4096 Jul 21 19:47 Session_20170721_194658_{49a6f90a-bb14-40fa-a864-0310465c9a82}
drwxr-xr-x 2 root root 4096 Jul 21 19:15 Session_20170721_191532_{5c9e048a-39e0-4d84-ad69-2f6465df60a5}
/var/log/veeam/Backup/BackupJob1/Session_20170728_154205_{20920194-caea-480a-bbe6-aee0db4bc3ee}# ls -lat
total 308
-rw-rw-r-- 1 root root 96705 Jul 28 15:48 Job.log
-rw-rw-r-- 1 root root 106287 Jul 28 15:48 Agent.Target.log
-rw-rw-r-- 1 root root 66602 Jul 28 15:48 Agent.Source.log
drwxr-xr-x 2 root root 4096 Jul 28 15:42 .
-rw-rw-r-- 1 root root 28776 Jul 28 15:42 Agent.Repair.log
drwxr-xr-x 6 root root 4096 Jul 28 15:42 ..
-
- Product Manager
- Posts: 5797
- Liked: 1215 times
- Joined: Jul 15, 2013 11:09 am
- Full Name: Niels Engelen
- Contact:
Re: Backup Notification Linux
That specific info is not in a file available. However you can find info in the database (/var/lib/veeam/veeam_db.sqlite). Other options are using scripts after the job has ran showing info based on the sessions (for example veeamconfig session list | grep -e UUID -e Failed | mailx -s "VAL session Failed" someone@somewhere.com )
If you have Veeam Backup & Replication you can send backup to the backup repo there and let it handle the mailflow.
If you have Veeam Backup & Replication you can send backup to the backup repo there and let it handle the mailflow.
Personal blog: https://foonet.be
GitHub: https://github.com/nielsengelen
GitHub: https://github.com/nielsengelen
-
- Novice
- Posts: 8
- Liked: 3 times
- Joined: Sep 27, 2017 4:50 am
- Full Name: Manfred
- Contact:
Re: Backup Notification Linux
I tried to build a notification script which provides nearly the same information as the windows agent notification...
Screenshots and download:
http://blog.grufo.com/2017/09/26/veeam- ... -versehen/
Screenshots and download:
http://blog.grufo.com/2017/09/26/veeam- ... -versehen/
-
- Enthusiast
- Posts: 44
- Liked: 2 times
- Joined: Nov 08, 2017 2:00 pm
- Full Name: Patrick Wilson
- Contact:
[MERGED] Email confirmations in Linux
Is there a way to set Agent for Linux to email me a confirmation when a backup job completes, like with the Windows version? I've not had much luck yet in finding this info. Thanks!
-
- Enthusiast
- Posts: 44
- Liked: 2 times
- Joined: Nov 08, 2017 2:00 pm
- Full Name: Patrick Wilson
- Contact:
Re: Scripting
Thank you Davide for the script. That worked for me!
-
- Enthusiast
- Posts: 44
- Liked: 2 times
- Joined: Nov 08, 2017 2:00 pm
- Full Name: Patrick Wilson
- Contact:
Re: Scripting
Hi Davide,
I previously had your script running successfully (after customizing it) on a server that is no longer up and running. I tried to run my saved copy on a different server and keep getting this output:
./valbackup2.sh: line 14: /etc/veeam/scripts/SystemBackup.tmp: No such file or directory
grep: /etc/veeam/scripts/SystemBackup.tmp: No such file or directory
grep: /etc/veeam/scripts/SystemBackup.tmp: No such file or directory
Error: Value for argument [--id] is required.
Do you have any suggestions? Your help would be greatly appreciated! Thanks!
I previously had your script running successfully (after customizing it) on a server that is no longer up and running. I tried to run my saved copy on a different server and keep getting this output:
./valbackup2.sh: line 14: /etc/veeam/scripts/SystemBackup.tmp: No such file or directory
grep: /etc/veeam/scripts/SystemBackup.tmp: No such file or directory
grep: /etc/veeam/scripts/SystemBackup.tmp: No such file or directory
Error: Value for argument [--id] is required.
Do you have any suggestions? Your help would be greatly appreciated! Thanks!
-
- Product Manager
- Posts: 5797
- Liked: 1215 times
- Joined: Jul 15, 2013 11:09 am
- Full Name: Niels Engelen
- Contact:
Re: Scripting
Are you sure the path /etc/veeam/scripts exist as well as the SystemBackup.tmp file?
Personal blog: https://foonet.be
GitHub: https://github.com/nielsengelen
GitHub: https://github.com/nielsengelen
-
- Product Manager
- Posts: 6551
- Liked: 765 times
- Joined: May 19, 2015 1:46 pm
- Contact:
Re: Scripting
Hi,
Niels is spot on - here are the lines that generate the error:
As you can see after you start the job it should send its output to /etc/veeam/scripts/$JOBNAME.tmp, which is, apparently. SystemBackup.tmp in your case. Please double check if line 10 from the script actually starts the SystemBackup job and creates corresponding .tmp file.
Thanks
Niels is spot on - here are the lines that generate the error:
Code: Select all
veeamconfig job start --name $JOBNAME 1> /etc/veeam/scripts/$JOBNAME.tmp 2> /etc/veeam/scripts/$JOBNAME.err
SESSION_ID=`grep ID $SCRIPT_DIR/$JOBNAME.tmp | awk '{print $3}' | sed 's/\[//' | sed 's/\]//' | sed 's/\.//'`
Thanks
-
- Enthusiast
- Posts: 44
- Liked: 2 times
- Joined: Nov 08, 2017 2:00 pm
- Full Name: Patrick Wilson
- Contact:
Re: Scripting
This is the first portion of the script that I have:
JOBNAME=SystemBackup
SCRIPT_DIR=/etc/veeam/scripts
LOG_DIR=/var/log/veeam/Backup/$JOBNAME
JOB_INFO=`veeamconfig job info --name $JOBNAME`
export JOBNAME
#TODAY=$(date +"%Y-%m-%d")
#export TODAY
#VEEAM_PID=`pgrep veeamjobman`
#export VEEAM_PID
veeamconfig job start --name $JOBNAME 1> /etc/veeam/scripts/$JOBNAME.tmp 2> /etc/veeam/scripts/$JOBNAME.err
SESSION_ID=`grep ID /etc/veeam/scripts/$JOBNAME.tmp | awk '{print $3}' | sed 's/\[//' | sed 's/\]//' | sed 's/\.//'`
export SESSION_ID
LOGDIR=`grep log /etc/veeam/scripts/$JOBNAME.tmp | awk '{print $4}' | sed 's/\[//' | sed 's/\]//' | sed 's/\.//'`
export LOGDIR
LOGFILE=$LOGDIR/Job.log
export LOGFILE
JOBNAME=SystemBackup
SCRIPT_DIR=/etc/veeam/scripts
LOG_DIR=/var/log/veeam/Backup/$JOBNAME
JOB_INFO=`veeamconfig job info --name $JOBNAME`
export JOBNAME
#TODAY=$(date +"%Y-%m-%d")
#export TODAY
#VEEAM_PID=`pgrep veeamjobman`
#export VEEAM_PID
veeamconfig job start --name $JOBNAME 1> /etc/veeam/scripts/$JOBNAME.tmp 2> /etc/veeam/scripts/$JOBNAME.err
SESSION_ID=`grep ID /etc/veeam/scripts/$JOBNAME.tmp | awk '{print $3}' | sed 's/\[//' | sed 's/\]//' | sed 's/\.//'`
export SESSION_ID
LOGDIR=`grep log /etc/veeam/scripts/$JOBNAME.tmp | awk '{print $4}' | sed 's/\[//' | sed 's/\]//' | sed 's/\.//'`
export LOGDIR
LOGFILE=$LOGDIR/Job.log
export LOGFILE
-
- Product Manager
- Posts: 5797
- Liked: 1215 times
- Joined: Jul 15, 2013 11:09 am
- Full Name: Niels Engelen
- Contact:
Re: Scripting
Can u doublecheck the folder exist under /etc/veeam by running ls /etc/veeam ?
If not try mkdir -p /etc/veeam/scripts and try again.
If not try mkdir -p /etc/veeam/scripts and try again.
Personal blog: https://foonet.be
GitHub: https://github.com/nielsengelen
GitHub: https://github.com/nielsengelen
Who is online
Users browsing this forum: No registered users and 9 guests