Find the answer to your Linux question:
Results 1 to 3 of 3
Alright- what I need is to automate a process that will replace one file on my hard drive with a file on a cd, and then reboot. I'm going to ...
  1. #1
    Just Joined!
    Join Date
    Jan 2007
    Posts
    2

    automated shell process?

    Alright- what I need is to automate a process that will replace one file on my hard drive with a file on a cd, and then reboot. I'm going to put this process on a custom linux live cd and have it autorun on startup. Then I will use it to update the file on multiple computers.

    Sooo, how can I write a shell program that will take a file from x location and place it at y location, automatically overwriting any files already there, and then reboot the system? Maybe even eject the drive, THEN reboot. That'd be sweet.

    Any help would be greatly appreciated! Thanks!

  2. #2
    Trusted Penguin Cabhan's Avatar
    Join Date
    Jan 2005
    Location
    Seattle, WA, USA
    Posts
    3,230
    Well, let's see...

    The mv command takes two arguments: the location of a file and the new location. It moves the file. Simple enough. Coincidentally, it also takes the -f option, which overwrites a file without asking for confirmation.

    For rebooting, assuming that this is being run by a privileged user (and init scripts do count), there is the conveniently named reboot command. You can alternatively call shutdown -r now.

    Finally, there is the (again aptly named) eject command that takes a device and ejects it.
    DISTRO=Arch
    Registered Linux User #388732

  3. #3
    Just Joined!
    Join Date
    Jan 2007
    Posts
    2
    alright thanks- i figured the commands were the same as in the terminal.

    i guess my main question is, how exactly do you make such a program? Can you just write it in a text editor and save it as a certain file type, similar to how you would make a BATCH file in windows?

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
...