Skip to main content
we don't like to use pastebin for 15-line scripts here
Source Link
sourcejedi
  • 53.5k
  • 23
  • 178
  • 336

I have a script that is suppose to stop and recover the process to run in the background:

process_id=`ps -eaf | grep -i daemon | grep -v grep | grep -v status | grep -v stop | awk '{print $2}'`
(kill -STOP $process_id) &
... # do something else 
(kill -CONT $process_id) &

This is working fine, but then in the STDOUT / STDERR this appears:

[1]  +  8545 Suspended (signal)            /etc/init.d/...

So far I tried to:

(kill -STOP $process_id)

(kill -STOP $process_id) & > /dev/null

/etc/init.d/{name_of_the_daemon} start > /dev/null

(kill -STOP $process_id & ) 2>/dev/null 

(kill -STOP $process_id & disown;) 2>/dev/null 

set +m
(kill -STOP $process_id) & 

(kill -STOP $process_id) & 1>&2

You can find a very simple version of my script here: https://pastebin.com/1x7z3AV5 (fff is the artificial name of the script)

If you want to replicate my error, theseThese are the steps that I'm doing:

  1. create a file fff in /etc/init.d/
  2. paste the raw script from the previous pastebinbelow
  3. chmod 755 fff
  4. /etc/init.d/fff start

After that, I receive the "suspended" message...

According to @sourcejedi my script is not a daemon; when a child process of the script has been suspended, the "suspended" message appears

How can I suppress the output from the shell for only that particular message?

Here is a very simple version of my script:

#!/bin/bash
 
pid_script=`ps -eaf | grep -i fff | grep -v grep | grep -v status | grep -v stop | awk '{print $2}'`
 
case "$1" in
    start)
    ( sleep 3; kill -STOP $pid_script ) &
    sleep 10;
    (sleep 1; kill -CONT $pid_script) &
    ;;
    stop)
    for p in $pid_script # kill all the other processes related with this script (if any)
        do
            kill -9 $p
        done
esac

I have a script that is suppose to stop and recover the process to run in the background:

process_id=`ps -eaf | grep -i daemon | grep -v grep | grep -v status | grep -v stop | awk '{print $2}'`
(kill -STOP $process_id) &
... # do something else 
(kill -CONT $process_id) &

This is working fine, but then in the STDOUT / STDERR this appears:

[1]  +  8545 Suspended (signal)            /etc/init.d/...

So far I tried to:

(kill -STOP $process_id)

(kill -STOP $process_id) & > /dev/null

/etc/init.d/{name_of_the_daemon} start > /dev/null

(kill -STOP $process_id & ) 2>/dev/null 

(kill -STOP $process_id & disown;) 2>/dev/null 

set +m
(kill -STOP $process_id) & 

(kill -STOP $process_id) & 1>&2

You can find a very simple version of my script here: https://pastebin.com/1x7z3AV5 (fff is the artificial name of the script)

If you want to replicate my error, these are the steps that I'm doing:

  1. create a file fff in /etc/init.d/
  2. paste the raw script from the previous pastebin
  3. chmod 755 fff
  4. /etc/init.d/fff start

After that, I receive the "suspended" message...

According to @sourcejedi my script is not a daemon; when a child process of the script has been suspended, the "suspended" message appears

How can I suppress the output from the shell for only that particular message?

I have a script that is suppose to stop and recover the process to run in the background:

process_id=`ps -eaf | grep -i daemon | grep -v grep | grep -v status | grep -v stop | awk '{print $2}'`
(kill -STOP $process_id) &
... # do something else 
(kill -CONT $process_id) &

This is working fine, but then in the STDOUT / STDERR this appears:

[1]  +  8545 Suspended (signal)            /etc/init.d/...

So far I tried to:

(kill -STOP $process_id)

(kill -STOP $process_id) & > /dev/null

/etc/init.d/{name_of_the_daemon} start > /dev/null

(kill -STOP $process_id & ) 2>/dev/null 

(kill -STOP $process_id & disown;) 2>/dev/null 

set +m
(kill -STOP $process_id) & 

(kill -STOP $process_id) & 1>&2

These are the steps that I'm doing:

  1. create a file fff in /etc/init.d/
  2. paste the script from below
  3. chmod 755 fff
  4. /etc/init.d/fff start

After that, I receive the "suspended" message...

According to @sourcejedi my script is not a daemon; when a child process of the script has been suspended, the "suspended" message appears

How can I suppress the output from the shell for only that particular message?

Here is a very simple version of my script:

#!/bin/bash
 
pid_script=`ps -eaf | grep -i fff | grep -v grep | grep -v status | grep -v stop | awk '{print $2}'`
 
case "$1" in
    start)
    ( sleep 3; kill -STOP $pid_script ) &
    sleep 10;
    (sleep 1; kill -CONT $pid_script) &
    ;;
    stop)
    for p in $pid_script # kill all the other processes related with this script (if any)
        do
            kill -9 $p
        done
esac
added 273 characters in body
Source Link
toom501
  • 205
  • 4
  • 10

I have a script that is suppose to stop and recover the process to run in the background:

process_id=`ps -eaf | grep -i daemon | grep -v grep | grep -v status | grep -v stop | awk '{print $2}'`
(kill -STOP $process_id) &
... # do something else 
(kill -CONT $process_id) &

This is working fine, but then in the STDOUT / STDERR this appears:

[1]  +  8545 Suspended (signal)            /etc/init.d/...

So far I tried to:

(kill -STOP $process_id)

(kill -STOP $process_id) & > /dev/null

/etc/init.d/{name_of_the_daemon} start > /dev/null

(kill -STOP $process_id & ) 2>/dev/null 

(kill -STOP $process_id & disown;) 2>/dev/null 

set +m
(kill -STOP $process_id) & 

(kill -STOP $process_id) & 1>&2

You can find a very simple version of my script here: https://pastebin.com/1x7z3AV5 (fff is the artificial name of the script)

If you want to replicate my error, these are the steps that I'm doing:

  1. create a file fff in /etc/init.d/
  2. paste the raw script from the previous pastebin
  3. chmod 755 fff
  4. /etc/init.d/fff start

After that, I receive the "suspended" message...

According to @sourcejedi my script is not a daemon; when a child process of the script has been suspended, the "suspended" message appears

How can I suppress the output from the shell for only that particular message?

I have a script that is suppose to stop and recover the process to run in the background:

process_id=`ps -eaf | grep -i daemon | grep -v grep | grep -v status | grep -v stop | awk '{print $2}'`
(kill -STOP $process_id) &
... # do something else 
(kill -CONT $process_id) &

This is working fine, but then in the STDOUT / STDERR this appears:

[1]  +  8545 Suspended (signal)            /etc/init.d/...

So far I tried to:

(kill -STOP $process_id)

(kill -STOP $process_id) & > /dev/null

/etc/init.d/{name_of_the_daemon} start > /dev/null

(kill -STOP $process_id & ) 2>/dev/null 

(kill -STOP $process_id & disown;) 2>/dev/null 

set +m
(kill -STOP $process_id) & 

(kill -STOP $process_id) & 1>&2

You can find a very simple version of my script here: https://pastebin.com/1x7z3AV5 (fff is the artificial name of the script)

According to @sourcejedi my script is not a daemon; when a child process of the script has been suspended, the "suspended" message appears

How can I suppress the output from the shell for only that particular message?

I have a script that is suppose to stop and recover the process to run in the background:

process_id=`ps -eaf | grep -i daemon | grep -v grep | grep -v status | grep -v stop | awk '{print $2}'`
(kill -STOP $process_id) &
... # do something else 
(kill -CONT $process_id) &

This is working fine, but then in the STDOUT / STDERR this appears:

[1]  +  8545 Suspended (signal)            /etc/init.d/...

So far I tried to:

(kill -STOP $process_id)

(kill -STOP $process_id) & > /dev/null

/etc/init.d/{name_of_the_daemon} start > /dev/null

(kill -STOP $process_id & ) 2>/dev/null 

(kill -STOP $process_id & disown;) 2>/dev/null 

set +m
(kill -STOP $process_id) & 

(kill -STOP $process_id) & 1>&2

You can find a very simple version of my script here: https://pastebin.com/1x7z3AV5 (fff is the artificial name of the script)

If you want to replicate my error, these are the steps that I'm doing:

  1. create a file fff in /etc/init.d/
  2. paste the raw script from the previous pastebin
  3. chmod 755 fff
  4. /etc/init.d/fff start

After that, I receive the "suspended" message...

According to @sourcejedi my script is not a daemon; when a child process of the script has been suspended, the "suspended" message appears

How can I suppress the output from the shell for only that particular message?

added 188 characters in body
Source Link
toom501
  • 205
  • 4
  • 10

I have a daemon script that is suppose to stop and recover the process to run in the background:

process_id=`ps -eaf | grep -i daemon | grep -v grep | grep -v status | grep -v stop | awk '{print $2}'`
(kill -STOP $process_id) &
... # do something else 
(kill -CONT $process_id) &

This is working fine, but then in the STDOUT / STDERR this appears:

[1]  +  8545 Suspended (signal)            /etc/init.d/...

So far I tried to:

(kill -STOP $process_id)

(kill -STOP $process_id) & > /dev/null

/etc/init.d/{name_of_the_daemon} start > /dev/null

(kill -STOP $process_id & ) 2>/dev/null 

(kill -STOP $process_id & disown;) 2>/dev/null 

set +m
(kill -STOP $process_id) & 

(kill -STOP $process_id) & 1>&2

You can find a very simple version of my daemonscript here: https://pastebin.com/1x7z3AV5 (fff is the artificial name of the daemon script)

How can I suppress it?According to @sourcejedi my script is not a daemon; when a child process of the script has been suspended, the "suspended" message appears

How can I suppress the output from the shell for only that particular message?

I have a daemon script that is suppose to stop and recover the process to run in the background:

process_id=`ps -eaf | grep -i daemon | grep -v grep | grep -v status | grep -v stop | awk '{print $2}'`
(kill -STOP $process_id) &
... # do something else 
(kill -CONT $process_id) &

This is working fine, but then in the STDOUT / STDERR this appears:

[1]  +  8545 Suspended (signal)            /etc/init.d/...

So far I tried to:

(kill -STOP $process_id)

(kill -STOP $process_id) & > /dev/null

/etc/init.d/{name_of_the_daemon} start > /dev/null

(kill -STOP $process_id & ) 2>/dev/null 

(kill -STOP $process_id & disown;) 2>/dev/null 

set +m
(kill -STOP $process_id) & 

(kill -STOP $process_id) & 1>&2

You can find a very simple version of my daemon here: https://pastebin.com/1x7z3AV5 (fff is the artificial name of the daemon script)

How can I suppress it?

I have a script that is suppose to stop and recover the process to run in the background:

process_id=`ps -eaf | grep -i daemon | grep -v grep | grep -v status | grep -v stop | awk '{print $2}'`
(kill -STOP $process_id) &
... # do something else 
(kill -CONT $process_id) &

This is working fine, but then in the STDOUT / STDERR this appears:

[1]  +  8545 Suspended (signal)            /etc/init.d/...

So far I tried to:

(kill -STOP $process_id)

(kill -STOP $process_id) & > /dev/null

/etc/init.d/{name_of_the_daemon} start > /dev/null

(kill -STOP $process_id & ) 2>/dev/null 

(kill -STOP $process_id & disown;) 2>/dev/null 

set +m
(kill -STOP $process_id) & 

(kill -STOP $process_id) & 1>&2

You can find a very simple version of my script here: https://pastebin.com/1x7z3AV5 (fff is the artificial name of the script)

According to @sourcejedi my script is not a daemon; when a child process of the script has been suspended, the "suspended" message appears

How can I suppress the output from the shell for only that particular message?

added 137 characters in body
Source Link
toom501
  • 205
  • 4
  • 10
Loading
Tweeted twitter.com/StackUnix/status/1042156565242019840
added 194 characters in body
Source Link
toom501
  • 205
  • 4
  • 10
Loading
added 193 characters in body
Source Link
toom501
  • 205
  • 4
  • 10
Loading
edited title
Source Link
Vlastimil Burián
  • 31.1k
  • 66
  • 209
  • 358
Loading
edited tags
Link
Vlastimil Burián
  • 31.1k
  • 66
  • 209
  • 358
Loading
deleted 99 characters in body
Source Link
Vlastimil Burián
  • 31.1k
  • 66
  • 209
  • 358
Loading
added 109 characters in body
Source Link
toom501
  • 205
  • 4
  • 10
Loading
Source Link
toom501
  • 205
  • 4
  • 10
Loading