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 run my system configuration script (written in python) after boot. System should ask for password for user USER and run my script. After that system should reboot, eventually run gui.

I would like to know what is best method to do something like that. User should not have access to bash... this is just for base configuration. I would like this to be option in grub, so user can run normal system or configuration script.

share|improve this question
    
Just add init=path_to_my_script in grub entry and then in script: os.execv('/sbin/init', ['/sbin/init']) -to run normal session :) –  marcinpz Jan 9 '12 at 13:05

2 Answers 2

You can't really add this as an option in grub, but I can tell you how to make the script run on login or when you open a terminal, but if you are not allowing someone to run the bash software, it should not be a problem.

Just add the line to your ~/.bashrc:

python SCRIPT_FILE_HERE (any arguments should also be added here)

and all should be sorted :)

share|improve this answer
    
Thank you. Generally I know that and I need something more: I can add grub entry to start session in runlevel=1 (for example), or maybe add some additional flag to existing grub entry, and during boot check if configuration should be run. –  marcinpz Dec 28 '11 at 14:16

I think this is what you're looking for, though it's very old (6.10).

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.