Linux Reboot


 
Thread Tools Search this Thread
Top Forums Shell Programming and Scripting Linux Reboot
# 1  
Old 11-28-2018
Linux Reboot

Hi Team,

I have a requirement where I need to execute couple of commands once whenever my server is rebooted.For example I used to receive a mail telling there is a planned server reboot for the next day.So I will touch a file
Code:
Reb.Lck

.

Once the server reboot complete for the next day(It can be at anytime for the day) I need to remove this file manually.Is there anyway we can automate in such a way that once the server reboot complete for the day remove the Reb.Lck file.

My server version is given below

Quote:
LSB_VERSION=base-4.0-amd64:base-4.0-noarch:core-4.0-amd64:core-4.0-noarch:graphics-4.0-amd64:graphics-4.0-noarchSmilierinting-4.0-amd64Smilierinting-4.0-noarch
Red Hat Enterprise Linux Server release 6.10 (Santiago)
Red Hat Enterprise Linux Server release 6.10 (Santiago)
# 2  
Old 11-28-2018
You may use cron for that:

/etc/cron.d/reboot-cleanup
Code:
@reboot root rm -f /path/to/Reb.Lck


Last edited by stomp; 11-28-2018 at 04:30 AM..
These 2 Users Gave Thanks to stomp For This Post:
# 3  
Old 11-28-2018
Thank you.. So just for my understanding
Code:
@reboot root rm -f /path/to/Reb.Lck

, this code will remove the Lck file immediately after the server reboot.
# 4  
Old 11-28-2018
Yes. For exact specification of @reboot read man:crontab(5)
Login or Register to Ask a Question

Previous Thread | Next Thread

10 More Discussions You Might Find Interesting

1. UNIX for Beginners Questions & Answers

Linux froze and got back working 5 days later, no reboot.

Hello my friends, I've come across the weirdest of glitches. I'm running a simple weather monitor (just temperature) on a Raspbeery Pi 3B (Raspbian Linux 4.14.98-v7+). It has a 3G modem that sends out simple packets to my server at home. On june 5th I lost remote access to the device.... (1 Reply)
Discussion started by: OmahaWiz
1 Replies

2. Linux

Issue in Bonding during Reboot(Linux)

Respected Members, We encountered an issue during node reboot when eth1 and eth5 of bond1 were behaving unusual(both eth1 and eth5 were in unknown states and ifdown and ifup were used to rectify). Please find the messages and configuration files as below and please let me know for any other... (0 Replies)
Discussion started by: Mudit Bansal
0 Replies

3. Red Hat

Update kernel Linux without reboot?!

Hi Is it a way ? When Linux kernel updated that don't want reboot it means without reboot the new kernel performances Thanks (7 Replies)
Discussion started by: mnnn
7 Replies

4. Shell Programming and Scripting

Script to Run Multiple Systems Checks and mail me the results after every reboot- Linux

Hello, I'm trying to create a mechanism wherein a set of Production servers will email me the results of system checks like Uptime, NFS Mounts and a Process after every scheduled reboot. For this, I figured I'd use the @reboot parameter that crond comes with. I have added the below onliner... (3 Replies)
Discussion started by: pocodot
3 Replies

5. Linux

Linux server reboot

We reboot our linux servers daily. Is it needed ? (10 Replies)
Discussion started by: linuxadmin
10 Replies

6. Red Hat

What is the optimal approach to reboot the linux server

Hi All, Our Linux server were rebooted 723 days before and now We have decided to reboot the server due to server performance. Could someone advise us what is the optimal duration of a server reboot ? Thanks for your time. Best Regards, Arun (2 Replies)
Discussion started by: arunap44
2 Replies

7. Shell Programming and Scripting

best way to reboot ?

Hi What is the best way to reboot a Linux computer? i) Press the power switch ii) type 'init 6' as any user, then enter the root password when prompted iii) Pour metal filings in the top of the computer. iv) su to root then type 'init 6' (6 Replies)
Discussion started by: tjay83
6 Replies

8. Solaris

different between soft reboot and hard reboot

Hi Guru's Can any want here could explain to me the different between soft reboot and hard reboot . Best Regards Seelan (3 Replies)
Discussion started by: seelan3
3 Replies

9. Shell Programming and Scripting

Script to Reboot a linux box from a windows box

HI All, I need a script to reboot a linux box from a windows box. The script needs to run automatically whenever a sitescope alerts with an error message. Have searched for this in the forums, but could not get something relative. Pls. let me know the various alternatives we have to do... (2 Replies)
Discussion started by: Crazy_murli
2 Replies

10. UNIX for Dummies Questions & Answers

reboot

Hi all, Quick question. Does anyone know what is the compination of buttons that I have to press to stop the start up so I can bring the system in a single user mode? I use HP Vis 9000 Thanks alot (1 Reply)
Discussion started by: guest100
1 Replies
Login or Register to Ask a Question