Cron won't restart rsyslog


 
Thread Tools Search this Thread
Top Forums Shell Programming and Scripting Cron won't restart rsyslog
# 8  
Old 01-17-2013
sudo is a utility to become root... so no point... for your culture look at the sudo man pages because you may have to use it one day day in batch mode... e.g. look at " -c" option ...
# 9  
Old 01-22-2013
I finally figured it out.

Cron wont run the restart command if its inside the script, but it will if it is in cron itself. So, I set it up like this
Code:
00 00 * * * /bin/systemctl restart rsyslog.service

and it restarts rsyslog.

Last question. I need the original script to run in this thread to run before the restart. I know I can have the first script run at 11 59 pm and the second script run at midnight (as Cron works in minutes but not seconds), but is there a way to run both at the same time? As in, at 11 59 pm it runs the script, then once the script is complete, restart rsyslog.

Thanks for the help so far,
Steve
# 10  
Old 01-22-2013
  1. I don't understand; your script should run, too.
  2. The cron command is executed in /bin/sh. You can have
Code:
command1; command2

or
Code:
command1 && command2

where command2 runs only if command1 was successful (exit status 0)
# 11  
Old 01-22-2013
So i can put in
Code:
59 23 * * * /usr/sbin/pixmove.sh && /bin/systemctl restart rsyslog.service

This will make pixmove.sh run, and after it finishes correctly, restart rsyslog at 11:59pm. Making sure this is correct.

Steve
# 12  
Old 01-24-2013
Everything worked as intended. Thanks for all the help.
Login or Register to Ask a Question

Previous Thread | Next Thread

9 More Discussions You Might Find Interesting

1. UNIX for Beginners Questions & Answers

Bash script won't run because hardware won't produce display

Can anyone offer any advice on how to modify the script below to work on a new system we have, that has no graphics capability? We admin the system through a serial RAS device. I've tried running the below script through the RAS and through an ssh -X session. It failed with something like "GTK... (3 Replies)
Discussion started by: yelirt5
3 Replies

2. Shell Programming and Scripting

RSYSLOG reports

I want to create reports using rsyslog in linux,Can someone help me out here ? Report Format must be "Hostname" "Username" "Hostname logged from" "Date" "Time" Regards, Ahmed. ---------- Post updated at 05:24 PM ---------- Previous update was at 05:24 PM ---------- Linux,Shell Script (10 Replies)
Discussion started by: ahmed.vaghar
10 Replies

3. AIX

won't mount /usr...won't boot fully

Hello: NOOB here. I attempted to use smit mkcd. Failed on first attempt, not enough space. 2nd attempt tried to place iso on /usr, not enough space there. Cleanup ran for about 5 minutes after aborting. Now AIX won't boot. LCD display on 7029-6E3 says: 0517 MOUNT /USR. Attempted to boot from CD... (11 Replies)
Discussion started by: bbird
11 Replies

4. UNIX for Dummies Questions & Answers

How to restart CRON file?

Hi How can I restart the CRON manually? Thanks (1 Reply)
Discussion started by: biot
1 Replies

5. Linux

How do cron restart on unix Tru64?

hi all, How do cron restart on unix Tru64? because don't run my cron jobs. few days age it's running fine. I did below steps: 1. cd /usr/sbin 2. cron stop responce: "! Cron is already running. Exiting... Tue Nov 27 14:38:00 2007" 3. cron start responce: "! Cron is already running.... (2 Replies)
Discussion started by: Tlg13team
2 Replies

6. Linux

How do cron restart on unix Tru64?

hi all, How do cron restart on unix Tru64? because don't run my cron jobs. few days age it's running fine. I did below steps: 1. cd /usr/sbin 2. cron stop response: "! Cron is already running. Exiting... Tue Nov 27 14:38:00 2007" 3. cron start response: "! Cron is already running.... (2 Replies)
Discussion started by: Tlg13team
2 Replies

7. UNIX for Dummies Questions & Answers

How to restart a CRON

If my cron has recieved a SIGTERM. How do I restart the cron? (7 Replies)
Discussion started by: ddrivera
7 Replies

8. UNIX for Dummies Questions & Answers

Cron won't run properly

I am new to unix, and this is my 1st post on this board. Looking for some advice about a cron job in my server. I am running a cron task that references a script which runs several other scripts and compiles them into a report and emails it to me. If I run the script manually, I will... (2 Replies)
Discussion started by: Steeler_fan
2 Replies

9. UNIX for Dummies Questions & Answers

Simple cron job won't work

I have a script in a directory -say users/me/test/ It looks like this: # "bkup" - copies specified files to the user's ~/Backup # directory after checking for name conflicts. a=$(date +%T) cp $1 ~/test/Backup/$1.$a It copies file.txt from current directory and timestamps the name of it of... (4 Replies)
Discussion started by: coregan
4 Replies
Login or Register to Ask a Question