Jump to content

How to use workflow to terminal commands?


Recommended Posts

Hi,

 

I want to use a series of terminal commands, first to open the terminal ( if needed ), change the user ( log in as another user ), enter in a folder and execute a command to start a SQL server and then log out and close the terminal window ( if needed, maybe I can do it without opening it ).

  After that I want to do the same to stop the server, but following the logic is the same script just changing the start to stop.

 

 

 

# Manually Start PostgreSQL
## su as user "postgres" and run server: 
su postgres 
# type the password ( if possible do it automatically )
cd /Library/PostgreSQL/9.0/bin/
./pg_ctl -D /Library/PostgreSQL/9.0/data/ start
# then logout 
exit
# close the terminal window
 
 
Anyway thanks for the attention !
Edited by gustavok
Link to comment

 

Hi,

 

I want to use a series of terminal commands, first to open the terminal ( if needed ), change the user ( log in as another user ), enter in a folder and execute a command to start a SQL server and then log out and close the terminal window ( if needed, maybe I can do it without opening it ).

  After that I want to do the same to stop the server, but following the logic is the same script just changing the start to stop.

 

 

 

# Manually Start PostgreSQL
## su as user "postgres" and run server: 
su postgres 
# type the password ( if possible do it automatically )
cd /Library/PostgreSQL/9.0/bin/
./pg_ctl -D /Library/PostgreSQL/9.0/data/ start
# then logout 
exit
# close the terminal window
 
 
Anyway thanks for the attention !

 

 

The trickiest part of this will be switching users because of the prompt for password. Would it be possible to edit the sudoers file and give the current user the ability to launch Postgres? That would make that part easier.

Link to comment

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...