Solved

backup script in linux

Posted on 2012-03-13
10
511 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
Why Off-Site Backups Are The Only Way To Go

You are probably backing up your data—but how and where? Ransomware is on the rise and there are variants that specifically target backups. Read on to discover why off-site is the way to go.

 
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

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.

Question has a verified solution.

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

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 …
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 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.:
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

623 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