Solved

backup script in linux

Posted on 2012-03-13
10
499 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
6 Surprising Benefits of Threat Intelligence

All sorts of threat intelligence is available on the web. Intelligence you can learn from, and use to anticipate and prepare for future attacks.

 
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

Find Ransomware Secrets With All-Source Analysis

Ransomware has become a major concern for organizations; its prevalence has grown due to past successes achieved by threat actors. While each ransomware variant is different, we’ve seen some common tactics and trends used among the authors of the malware.

Join & Write a Comment

Setting up Secure Ubuntu server on VMware 1.      Insert the Ubuntu Server distribution CD or attach the ISO of the CD which is in the “Datastore”. Note that it is important to install the x64 edition on servers, not the X86 editions. 2.      Power on th…
This article will explain how to establish a SSH connection to Ubuntu through the firewall and using a different port other then 22. I have set up a Ubuntu virtual machine in Virtualbox and I am running a Windows 7 workstation. From the Ubuntu vi…
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.:
Get a first impression of how PRTG looks and learn how it works.   This video is a short introduction to PRTG, as an initial overview or as a quick start for new PRTG users.

747 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

10 Experts available now in Live!

Get 1:1 Help Now