Basically this is the question im trying to answer
2) Write a shell script (fridaybackup.sh) which will, if run on Friday, backup all files in user2 home directory. The script will create a backup (tar) file named user2backup.tar and zip file named user2backup.zip
This is what I have so far
#!/bin/sh
echo
echo "Do you want to create a full backup (Y=Yes, N=No) : \c"
read INPUT
day=$(date +%A)
time=$(date +%m-%d-%y)
filename=user2backup${time}.tar.gz
srcdir='/export/home/student/user2'
desdir='/export/home/student/backupfolder'
case $INPUT in
N) echo "Bye." ;;
Y)
if [ "$day" = "Monday" ]
then
tar -cpzf $desdir/$filename $srcdir
else
echo "A full backup is done on Fridays only!!!"
fi ;;
*) echo "Error" ;;
esac
But I get this result
student@solaris:~/user2$ sh fridaybackup.sh
Do you want to create a full backup (Y=Yes, N=No) : Y
tar: /export/home/student/backupfolder/user2backup10-02-17.tar.gz: No
such file or directory
student@solaris:~/user2$ gedit fridaybackup.sh
Any help would be great and thanks in advance