1

When executing my backup bash script, all goes fine including executing two lines of enscript (enscript converts a log file to .html and.pdf format in my case).

Problem is running the same script when executed in crontab. The enscript lines are not executed. The backup, logging etc work fine except the enscript lines!(?)

Any suggestions are appreciated. BTW, my scripting skills are a litte limited so I might have forgot something.

The script:

#!/bin/sh
# script created by John Nomedal

rm /home/adminuser/Backup_Cakebox_Server.*

timer1=$(date +"%s")
starttime=$(date +"%d %B %Y %T")
echo "Starting backup at $starttime" >> /home/adminuser/Backup_Cakebox_Server.log
echo >> /home/adminuser/Backup_Cakebox_Server.log

rsync -aAXvP --exclude-from '/home/adminuser/rsync-exclude.txt' --delete / /media/adminuser/Backup/cakebox --log-file=/home/adminuser/Backup_Cakebox_Server.log

timer2=$(date +"%s")
stoptime=$(date +"%d %B %Y %T")
echo >> /home/adminuser/Backup_Cakebox_Server.log
echo "Backup finished at $stoptime" >> /home/adminuser/Backup_Cakebox_Server.log

diff=$(($timer2-$timer1))
echo "Backup completed in $(($diff / 3600 )) hours $((($diff % 3600) / 60)) minutes $(($diff % 60)) seconds" >> /home/adminuser/Backup_Cakebox_Server.log

# create html and pdf files
enscript --language=html -pBackup_Cakebox_Server.html Backup_Cakebox_Server.log
enscript Backup_Cakebox_Server.log -o - | ps2pdf - Backup_Cakebox_Server.pdf

cp /home/adminuser/Backup_Cakebox_Server.* /home/adminuser/html/cakebox/
cp /home/adminuser/backup.sh /home/adminuser/html/cakebox/Last_script_used

# last update 010215 incl enscript and rename backuplog.txt to Backup_Cakebox_Server.log and copy of backup.sh to Last_script_used

1 Answer 1

1

FIXED,

Needed full path,

enscript --language=html -p/home/adminuser/Backup_Cakebox_Server.html /home/adminuser/Backup_Cakebox_Server.log
enscript /home/adminuser/Backup_Cakebox_Server.log -o - | ps2pdf - /home/adminuser/Backup_Cakebox_Server.pdf

...sorry for this unnecessary posting....

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .