LinuxQuestions.org
Download your favorite Linux distribution at LQ ISO.
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Software
User Name
Password
Linux - Software This forum is for Software issues.
Having a problem installing a new program? Want to know which application is best for the job? Post your question in this forum.

Notices


Reply
  Search this Thread
Old 09-09-2011, 02:39 PM   #1
Claxton
LQ Newbie
 
Registered: Sep 2011
Posts: 16

Rep: Reputation: Disabled
Run shell script from Linux USB boot


Hello

I have Xubuntu on my USB key and would like to be able to run a custom shell script I wrote from the USB as soon as Xubuntu starts. Is there an entry point somewhere?

How can I proceed? Any tools/recommendations/directions are welcome.
 
Old 09-09-2011, 02:44 PM   #2
repo
LQ 5k Club
 
Registered: May 2001
Location: Belgium
Distribution: Arch
Posts: 8,528

Rep: Reputation: 899Reputation: 899Reputation: 899Reputation: 899Reputation: 899Reputation: 899Reputation: 899
Depends what script you want to run, and when in the boot process.
You can put the script in
Code:
/etc/rc.local
Kind regards
 
Old 09-09-2011, 02:49 PM   #3
Claxton
LQ Newbie
 
Registered: Sep 2011
Posts: 16

Original Poster
Rep: Reputation: Disabled
Quote:
Originally Posted by repo View Post
Depends what script you want to run, and when in the boot process.
You can put the script in
Code:
/etc/rc.local
Kind regards

I though this would be possible only if the OS is installed on the HDD? I want to run both Xubuntu and script from a USB, and as we know the OS is encapsulated within the USB drive and every changes will be erased after each boot. Am I right?

Last edited by Claxton; 09-09-2011 at 02:50 PM.
 
Old 09-09-2011, 03:29 PM   #4
schneidz
LQ Guru
 
Registered: May 2005
Location: boston, usa
Distribution: fc-15/ fc-20-live-usb/ aix
Posts: 5,236

Rep: Reputation: 914Reputation: 914Reputation: 914Reputation: 914Reputation: 914Reputation: 914Reputation: 914Reputation: 914
most live-usb's nowadays have some persistent overlay file which will survive thru a reboot.
 
Old 09-09-2011, 05:18 PM   #5
jefro
Moderator
 
Registered: Mar 2008
Posts: 18,639

Rep: Reputation: 2789Reputation: 2789Reputation: 2789Reputation: 2789Reputation: 2789Reputation: 2789Reputation: 2789Reputation: 2789Reputation: 2789Reputation: 2789Reputation: 2789
Depending how your install it may or may not be possible Not all live usb's made with unetbootin or live usb creator can have some of the base changed.

If you made your usb from the live cd so that it was a real install like any other hard drive install then it is exactly like a hard drive install. For some reason most people do not install to a flash drive from Linux installer.

The live usb creators are way safer. An install to a usb external or flash needs to have the loader put on the usb. Any newbies get confused and bork their install. I know that from experience. I borked my dos, windows 95, windows 98, ME, XP. I guess I got lucky with Windows 7 so far.
 
Old 09-11-2011, 11:50 PM   #6
Claxton
LQ Newbie
 
Registered: Sep 2011
Posts: 16

Original Poster
Rep: Reputation: Disabled
I fixed the problem by recreating a persistent live key but by allocating extra space on it (128 mb)
 
Old 09-12-2011, 01:53 PM   #7
Claxton
LQ Newbie
 
Registered: Sep 2011
Posts: 16

Original Poster
Rep: Reputation: Disabled
I bump this thread instead of creating another one.

I have been able to run the script and I know for a fact it get executed because it creates a file. However, I don't see the output of the "echo" command when I do..

Code:
echo "creating file"
echo "test file" > file.txt
sleep 2s
file.txt gets created but the echo "creating file", I don't see it anywhere during the boot. Is it related to the GUI ?
 
Old 09-12-2011, 03:29 PM   #8
schneidz
LQ Guru
 
Registered: May 2005
Location: boston, usa
Distribution: fc-15/ fc-20-live-usb/ aix
Posts: 5,236

Rep: Reputation: 914Reputation: 914Reputation: 914Reputation: 914Reputation: 914Reputation: 914Reputation: 914Reputation: 914
yeah, since it has not open terminal it has nowhere to pipe the string to.

maybe it is located in this file:
~/.xsession-errors
 
Old 09-12-2011, 03:46 PM   #9
Claxton
LQ Newbie
 
Registered: Sep 2011
Posts: 16

Original Poster
Rep: Reputation: Disabled
Quote:
Originally Posted by schneidz View Post
yeah, since it has not open terminal it has nowhere to pipe the string to.

maybe it is located in this file:
~/.xsession-errors


so how do I make a terminal showing at the start-up?
 
  


Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search

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 Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
Run Shell script when boot Linux haseit Linux - Newbie 3 03-19-2009 08:26 PM
how to automatic run a shell script at boot? ceantuco Linux - Newbie 36 10-09-2008 01:08 PM
How to run a shell script on boot up? AussieGit Linux - Newbie 4 11-02-2005 07:10 PM
Run shell script in RedHat after boot dmorse Linux - General 1 08-23-2005 02:54 PM
RH8 - how to automatically run a shell script at boot time nu-B Linux - Newbie 2 11-03-2003 03:47 PM

LinuxQuestions.org > Forums > Linux Forums > Linux - Software

All times are GMT -5. The time now is 01:50 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
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration