Code::Blocks Forums

User forums => Help => Topic started by: antotan on February 26, 2010, 11:49:47 am

Title: Run command after build
Post by: antotan on February 26, 2010, 11:49:47 am
Hello. I need to run "apache2ctl restart" after every project build.
How can I do this?
Title: Re: Run command after build
Post by: Jenna on February 26, 2010, 11:57:48 am
Hello. I need to run "apache2ctl restart" after every project build.
How can I do this?
Use the postbuild steps in the projects build options.
Title: Re: Run command after build
Post by: antotan on February 26, 2010, 12:19:21 pm
thank you. I'v put in post build steps "sudo apache2ctl restart" but, obviusly, c::b told me that there's no tty and no askpass specified.
How can I allow execution of apache2ctl from my user, without do sudo? Or, how can I prompt a password within c::b?
Title: Re: Run command after build
Post by: rcoll on February 26, 2010, 12:25:31 pm
Write a script or batch file that will do exactly what you want it to do, then run that script or batch file from the post-build steps.

Ringo
Title: Re: Run command after build
Post by: Jenna on February 26, 2010, 12:32:33 pm
Write a script or batch file that will do exactly what you want it to do, then run that script or batch file from the post-build steps.

Ringo

The script still needs root-access.

But the script can be run thro a graphical front-end to su.

I use "su-to-root" from the "menu"-package, but "gksu" or "kdesudo" should also work.

In my case: "su-to-root -X -c </path/to/script>"