Take the 2-minute tour ×
Ask Ubuntu is a question and answer site for Ubuntu users and developers. It's 100% free, no registration required.

I want to make a live usb boot just to execute a script with echo off. Then, I want it to continue to boot on to the original OS. I need to repair a bunch of computers that got attacked through the network. Select few have slight changes so, I would like it to continue to boot just to test. The faster the better because I have ~250 to get through. So, essentially I'm asking if I can boot to run a shell script.

share|improve this question

1 Answer 1

up vote 1 down vote accepted

I think that may work for you.

First you could create Linux Live USB stick in persistent mode. Persistent means your changes are stored on the pendrive too, so you can modify the system as you need. Easiest way to do it is to simply install distro on pendrive. You should probably think about something like DSL (Damm Small Linux) if you care about time.

Then you should modify the system to run your script right after booting. It can be achieved many ways e.g.

  • calling your script from /etc/rc.local
  • using cron
  • using something like update-rc.d, depending on distro

Note that you don't event need to run X server on startup, you will save some time disabling it.

Your script should reboot the machine once finishes since you want to boot original system.


Summing up, your walkthrough with this solution will look like:

  1. Insert pendrive to the port
  2. Start machine
  3. Choose to boot from USB
  4. Wait until script finishes and reboots the machine
  5. Remove pendrive and watch original system booting

I assumed here that default order of booting on all machines is hard drive before USB. Otherwise you will have to remove pendrive before booting original OS and forget about point 3.

share|improve this answer

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.