Solved

backup script in linux

Posted on 2012-03-13
10
501 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
 
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
U.S. Department of Agriculture and Acronis Access

With the new era of mobile computing, smartphones and tablets, wireless communications and cloud services, the USDA sought to take advantage of a mobilized workforce and the blurring lines between personal and corporate computing resources.

 
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 6

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

Ransomware-A Revenue Bonanza for Service Providers

Ransomware – malware that gets on your customers’ computers, encrypts their data, and extorts a hefty ransom for the decryption keys – is a surging new threat.  The purpose of this eBook is to educate the reader about ransomware attacks.

Question has a verified solution.

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

Suggested Solutions

You ever wonder how to backup Linux system files just like Windows System Restore?  Well you can use Timeshift in Linux to perform those similar action.  This tutorial will show you how to backup your system files and keep regular intervals. Note…
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…
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 find files with the shell using the find and locate commands. Use locate to find a needle in a haystack.: With locate, check if the file still exists.: Use find to get the actual location of the file.:

930 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

Need Help in Real-Time?

Connect with top rated Experts

9 Experts available now in Live!

Get 1:1 Help Now