Results 1 to 6 of 6

Thread: How to create a Linux Batch file to run at startup?

  1. #1
    Join Date
    Jan 2010
    Beans
    295

    How to create a Linux Batch file to run at startup?

    I am use to microsoft products.
    In microsoft windows, I can make a batch file that says to delete a file on the desktop during startup.

    I would like to create a "batch file" or command that runs at logon in Ubuntu.
    An example: If I wanted to delete a certain file on the desktop called "new.pdf" everytime I logon,
    Could I make some kind of file the has the commands "rm new.pdf" in it and run it as
    a file during login?

  2. #2
    Join Date
    Dec 2009
    Beans
    540
    Distro
    Ubuntu 10.04 Lucid Lynx

    Re: How to create a Linux Batch file to run at startup?

    You can add it to your /etc/rc.local

  3. #3
    Join Date
    Jan 2010
    Beans
    295

    Re: How to create a Linux Batch file to run at startup?

    Quote Originally Posted by patchwork View Post
    You can add it to your /etc/rc.local

    Can you please be more specific... I know very little about this. A step by step would be awesome!

  4. #4
    Join Date
    Dec 2009
    Beans
    540
    Distro
    Ubuntu 10.04 Lucid Lynx

    Re: How to create a Linux Batch file to run at startup?

    The rc.local is executed on start-up (actually, it is executed on each muti-user runlevel, but for our purposes start-up will suffice).

    Just open the file..
    Code:
    sudo gedit /etc/rc.local
    and add the 'rm /some/file/name' command before the 'exit 0'

  5. #5
    Join Date
    Jan 2010
    Beans
    295

    Re: How to create a Linux Batch file to run at startup?

    I will post when I get it to work. Thanks

  6. #6
    Join Date
    Jan 2008
    Location
    Minnesota
    Beans
    20
    Distro
    Ubuntu 9.10 Karmic Koala

    Re: How to create a Linux Batch file to run at startup?

    As a best practice, you should use gksudo instead of sudo whenever launching a program that operates with a graphical user interface:

    http://ubuntuforums.org/showthread.p...ghlight=gksudo

    Code:
    gksudo gedit /etc/rc.local

Bookmarks

Posting Permissions

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