Run script on crouton start up

1.3k Views Asked by At

I have a chromebook, running crouton. I have a particular script I want to run when crouton starts (i.e., when I enter the chroot with enter-chroot). Is there a way to do this? Searching google for this is giving me pages about starting crouton automatically when ChromeOS starts, not about running a script automatically when crouton starts.

1

There are 1 best solutions below

0
On

Using Startup Applications

I had the same question and was able to solve my problem.

First, make sure that your script is accessible to your user (you can put it in your home directory). Also make sure that your script is executable:

chmod +x myScript.sh

If you are using Ubuntu with the unity-desktop target, you'll have Startup Applications already installed. You can add any command you want to run on crouton startup there.

Running a script without root access

The command you would add would be sh /home/{username-here}/path/myScript.sh.

Running a script that requires root access

You have two options.

  1. Run it with root access automatically like shown here
  2. Open a terminal that runs your script and prompts for your password

    • The command you would add would be something like this: gnome-terminal -e /home/{username-here}/path/myScript.sh