Solved

backup script in linux

Posted on 2012-03-13
10
509 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
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
Efficient way to get backups off site to Azure

This user guide provides instructions on how to deploy and configure both a StoneFly Scale Out NAS Enterprise Cloud Drive virtual machine and Veeam Cloud Connect in the Microsoft Azure Cloud.

 
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

Ransomware: The New Cyber Threat & How to Stop It

This infographic explains ransomware, type of malware that blocks access to your files or your systems and holds them hostage until a ransom is paid. It also examines the different types of ransomware and explains what you can do to thwart this sinister online threat.  

Question has a verified solution.

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

Suggested Solutions

Linux users are sometimes dumbfounded by the severe lack of documentation on a topic. Sometimes, the documentation is copious, but other times, you end up with some obscure "it varies depending on your distribution" over and over when searching for …
The purpose of this article is to demonstrate how we can use conditional statements using Python.
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.
This demo shows you how to set up the containerized NetScaler CPX with NetScaler Management and Analytics System in a non-routable Mesos/Marathon environment for use with Micro-Services applications.
Suggested Courses

751 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