LinuxQuestions.org
Share your knowledge at the LQ Wiki.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - General
User Name
Password
Linux - General This Linux forum is for general Linux questions and discussion.
If it is Linux Related and doesn't seem to fit in any other forum then this is the place.

Notices


Reply
  Search this Thread
Old 01-08-2014, 07:45 AM   #1
Thaidog
Member
 
Registered: Sep 2002
Location: Hilton Head, SC
Distribution: Gentoo
Posts: 637

Rep: Reputation: 32
Question I need a one time script to kick off after a reboot


What is the best method to kick off a one time script to run after a system has succesfully rebooted? I have an issue where VMware tools needs to be re-ran after I run yum update and reboot the VM. I was thinking an at job but what if the time to get the system up has passed the time supplied for the script to run?
 
Old 01-08-2014, 07:54 AM   #2
druuna
LQ Veteran
 
Registered: Sep 2003
Posts: 10,532
Blog Entries: 7

Rep: Reputation: 2405Reputation: 2405Reputation: 2405Reputation: 2405Reputation: 2405Reputation: 2405Reputation: 2405Reputation: 2405Reputation: 2405Reputation: 2405Reputation: 2405
Quote:
Originally Posted by Thaidog View Post
What is the best method to kick off a one time script to run after a system has succesfully rebooted? I have an issue where VMware tools needs to be re-ran after I run yum update and reboot the VM. I was thinking an at job but what if the time to get the system up has passed the time supplied for the script to run?
Maybe you can use /etc/rc.local to kick of your script. The rc.local script is run once after all the rc stuff is done and before you can log in.

I just noticed you mention Gentoo as being your distro. I do believe Gentoo uses /etc/conf/local.start (or something similar) instead.
 
1 members found this post helpful.
Old 01-08-2014, 08:10 AM   #3
Habitual
LQ Veteran
 
Registered: Jan 2011
Location: Abingdon, VA
Distribution: Catalina
Posts: 9,374
Blog Entries: 37

Rep: Reputation: Disabled
a working example I have used:

/root/runmeonce.sh:
Code:
#!/bin/bash
do stuff here...
chmod 0000 `basename $0`
# EOF
the
Code:
chmod 0000 `basename $0`
will make non-executable, so success "runs" won't do anything at all.
 
Old 01-08-2014, 08:45 AM   #4
schneidz
LQ Guru
 
Registered: May 2005
Location: boston, usa
Distribution: fedora-35
Posts: 5,313

Rep: Reputation: 918Reputation: 918Reputation: 918Reputation: 918Reputation: 918Reputation: 918Reputation: 918Reputation: 918
for the system to do it automatically, i would put it in /etc/rc.local.
for the user to do it once logged in you can put it in ~/.bash_profile.
some newer distros support a @reboot directive in the users crontab.
 
Old 01-15-2014, 07:38 AM   #5
Thaidog
Member
 
Registered: Sep 2002
Location: Hilton Head, SC
Distribution: Gentoo
Posts: 637

Original Poster
Rep: Reputation: 32
Quote:
Originally Posted by schneidz View Post
for the system to do it automatically, i would put it in /etc/rc.local.
for the user to do it once logged in you can put it in ~/.bash_profile.
some newer distros support a @reboot directive in the users crontab.
I went with the @reboot command thanks!
 
Old 01-15-2014, 08:04 AM   #6
druuna
LQ Veteran
 
Registered: Sep 2003
Posts: 10,532
Blog Entries: 7

Rep: Reputation: 2405Reputation: 2405Reputation: 2405Reputation: 2405Reputation: 2405Reputation: 2405Reputation: 2405Reputation: 2405Reputation: 2405Reputation: 2405Reputation: 2405
@Thaidog: If you consider this solved, can you put up the [SOLVED] tag?
 
  


Reply



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
Each time a script is called. A log file is created with time and date + Bash Script. y0_gesh Programming 6 08-17-2012 03:16 AM
Why does my system reboot every time i try.... Hdstdlxe Linux - Newbie 9 10-22-2005 04:31 AM
Linux more expesive ... Haa haa ha - time to kick some ass gdbugger General 25 04-08-2004 03:04 PM
Shell script to kick off two apps at once cleaner416 Programming 4 11-05-2003 08:55 PM
time changes after reboot sandman Linux - General 4 02-16-2003 06:43 PM

LinuxQuestions.org > Forums > Linux Forums > Linux - General

All times are GMT -5. The time now is 08:02 PM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration