Solved

backup script in linux

Posted on 2012-03-13
10
508 Views
Last Modified: 2012-06-27
i have a new linux server where dailybackup is scheduled but it is not running. it is the cold backup scipt for database server. the script is attached here.

the crontab entry is as

[root@aadapps DR]#  crontab -l
00 01 * * * /scripts/dailybkp.sh >> /var/log/testcron.log
dailybkp1.sh
0
Comment
Question by:kurajesh
10 Comments
 
LVL 11

Assisted Solution

by:legolasthehansy
legolasthehansy earned 500 total points
ID: 37714551
Is /scripts/dailybkp.sh executable

ls -l /scripts/dailybkp.sh
chmod 755 /scripts/dailybkp.sh
0
 
LVL 1

Author Comment

by:kurajesh
ID: 37714599
before it was like as folows:
[root@aadapps scripts]# ls -l
total 16
drwxrwxrwx 2 root root 4096 Feb  4 13:26 bkplog
-rwxrwxrwx 1 root root 3309 Mar 13 17:18 dailybkp.sh
-rwxrwxrwx 1 root root  302 Feb  4 11:42 shutdown.sh
-rwxrwxrwx 1 root root  270 Feb  4 11:42 startup.sh


now i have explicitly given as:

[root@aadapps scripts]# chmod 755 dailybkp.sh

[root@aadapps scripts]# ls -l
total 16
drwxrwxrwx 2 root root 4096 Feb  4 13:26 bkplog
-rwxr-xr-x 1 root root 3309 Mar 13 17:18 dailybkp.sh
-rwxrwxrwx 1 root root  302 Feb  4 11:42 shutdown.sh
-rwxrwxrwx 1 root root  270 Feb  4 11:42 startup.sh


is that the reason
0
 
LVL 11

Assisted Solution

by:legolasthehansy
legolasthehansy earned 500 total points
ID: 37714631
Does it execute when you invoke the script from the command line?

/scripts/dailybkp.sh

Have you restarted the CRON services after you made changes to it?

service crond restart
0
Comprehensive Backup Solutions for Microsoft

Acronis protects the complete Microsoft technology stack: Windows Server, Windows PC, laptop and Surface data; Microsoft business applications; Microsoft Hyper-V; Azure VMs; Microsoft Windows Server 2016; Microsoft Exchange 2016 and SQL Server 2016.

 
LVL 5

Expert Comment

by:1ly4me
ID: 37714893
First Try to run bash script from root user,
#./scripts/dailybkp.sh

Open in new window

If it works, then crontab also  works.
Make sure that log file exists /var/log/testcron.log
Rajan
0
 
LVL 1

Author Comment

by:kurajesh
ID: 37714907
i have not invoked the dailybkp script as it is a production server. i will check as per the schedule.

but i have restarted the crond service

is there anything to check apart from this
0
 
LVL 1

Author Comment

by:kurajesh
ID: 37714917
the testcron.log file is there

-rwxrwxrwx 1 root  root       0 Feb  5 01:00 testcron.log
0
 
LVL 7

Expert Comment

by:torakeshb
ID: 37714928
I believe you need to update the script with full path for the commands. eg: /bin/rm, /bin/tar etc..
0
 
LVL 11

Assisted Solution

by:legolasthehansy
legolasthehansy earned 500 total points
ID: 37715005
So it means the script executes by taking a look at the time stamp on the log file. You would have to see whats wrong the script. Nothing wrong with CRON.
0
 
LVL 1

Accepted Solution

by:
Joe_Pritchard earned 0 total points
ID: 37729328
I'd double check that you are specifying full paths to the commands called from within the script, as torakeshb suggests. That or set cron's PATH explicitly, but better the first option...

You can find out where things live by running 'which <command>' at the command line.
0
 
LVL 1

Author Closing Comment

by:kurajesh
ID: 37776556
i have manually edited the script and now it is ok , thanks
0

Featured Post

What is SQL Server and how does it work?

The purpose of this paper is to provide you background on SQL Server. It’s your self-study guide for learning fundamentals. It includes both the history of SQL and its technical basics. Concepts and definitions will form the solid foundation of your future DBA expertise.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Have you ever been frustrated by having to click seven times in order to retrieve a small bit of information from the web, always the same seven clicks, scrolling down and down until you reach your target? When you know the benefits of the command l…
Fine Tune your automatic Updates for Ubuntu / Debian
Learn several ways to interact with files and get file information from the bash shell. ls lists the contents of a directory: Using the -a flag displays hidden files: Using the -l flag formats the output in a long list: The file command gives us mor…
Learn how to navigate the file tree with the shell. Use pwd to print the current working directory: Use ls to list a directory's contents: Use cd to change to a new directory: Use wildcards instead of typing out long directory names: Use ../ to move…

740 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question