Daily Useful Examples


English Version

Este foi o meu primeiro post, ha operacoes na base de dados demoram muito tempo a executar, e aconselhavel correr no lado do servidor.
O prefixo nohup assegura que o commando continua a correr.
O uso do "&" envia o comando para "background", libertando assim a linha de commando.
Em seguida formas  formas de gerir esta abordagem.  

Run - nohup + background + foreground


$ nohup sqlplus $UP @update_data.sql &
[2] 155548
 nohup: ignoring input and appending output to `nohup.out'

jobs
[1]+  Running                 nohup sqlplus $UP @update_data.sql &

fg 1
nohup sqlplus $UP @update_data.sql
Ctrl+C

Run - nohup + grep + kill



$ nohup sqlplus $UP @update_data.sql &
[1] 294427
>rmsepsup:orarmsps@ed1qdb02.tjx.com> nohup: ignoring input and appending output to `nohup.out'

$ ps -ef | grep -i update_data.sql
orarmsps 294427  80866 93 05:30 pts/1    00:00:16 sqlplus                    @update_data.sql
orarmsps 295439  80866  0 05:31 pts/1    00:00:00 grep -i update_data.sql

$ kill -9 294427

$ ps -ef | grep -i update_data.sql
orarmsps 331311  80866  0 05:34 pts/1    00:00:00 grep -i update_data.sql
[1]+  Killed                  nohup sqlplus $UP @update_data.sql


Obrigado pela leitura, espero que este post o tenha ajudado.
Versao Portuguesa

This was my 1st post ever, sometimes it's is need to run long operations on the database, is recommendable to ran these task in command line on the server side.

The nohup insures the OS will keep run the command even in the event we lose the network connection,

Using "&" will send the command  execution to "background".

Next, I'm showing two approaches to manage this.

Run - nohup + background + foreground


nohup sqlplus $UP @update_data.sql &
[2] 155548
 nohup: ignoring input and appending output to `nohup.out'

jobs
[1]+  Running                 nohup sqlplus $UP @update_data.sql &

fg 1
nohup sqlplus $UP @update_data.sql
Ctrl+C

Run - nohup + grep + kill



$ nohup sqlplus $UP @update_data.sql &
[1] 294427
>rmsepsup:orarmsps@ed1qdb02.tjx.com> nohup: ignoring input and appending output to `nohup.out'

$ ps -ef | grep -i update_data.sql
orarmsps 294427  80866 93 05:30 pts/1    00:00:16 sqlplus                    @update_data.sql
orarmsps 295439  80866  0 05:31 pts/1    00:00:00 grep -i update_data.sql

$ kill -9 294427

$ ps -ef | grep -i update_data.sql
orarmsps 331311  80866  0 05:34 pts/1    00:00:00 grep -i update_data.sql
[1]+  Killed                  nohup sqlplus $UP @update_data.sql

Thank you for reading, hope this post was helpful.

Comments