How to use notify-send to notify users as root? [duplicate]












1















This question already has an answer here:




  • Using notify-send with cron

    12 answers




#!/bin/bash
export DISPLAY=:0
state=$(upower -i $(upower -e | grep BAT) | grep --color=never -E "state" )
stat=${state:25:32}
batperct=$(upower -i $(upower -e | grep '/battery') | grep -E "percentage:")
bat=${batperct:24:26}
intbat=$(echo $bat | cut -d'%' -f1)
if [ "$intbat" -lt "15" -a "$stat" == "discharging" ]; then
notify-send 'battery low..! please plugin charger..... charge is only' "$intbat"
fi


The script runs fine when run as a normal user (bash script.sh). The desktop notification is displayed.



If I run it as root with sudo bash script.sh, the desktop notification is not displayed.



How can I use notify-send to notify users as root?



I am using Arch Linux.










share|improve this question









New contributor




Prinz Piuz is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.











marked as duplicate by roaima, RalfFriedl, terdon shell-script
Users with the  shell-script badge can single-handedly close shell-script questions as duplicates and reopen them as needed.

StackExchange.ready(function() {
if (StackExchange.options.isMobile) return;

$('.dupe-hammer-message-hover:not(.hover-bound)').each(function() {
var $hover = $(this).addClass('hover-bound'),
$msg = $hover.siblings('.dupe-hammer-message');

$hover.hover(
function() {
$hover.showInfoMessage('', {
messageElement: $msg.clone().show(),
transient: false,
position: { my: 'bottom left', at: 'top center', offsetTop: -7 },
dismissable: false,
relativeToBody: true
});
},
function() {
StackExchange.helpers.removeMessages();
}
);
});
});
19 hours ago


This question has been asked before and already has an answer. If those answers do not fully address your question, please ask a new question.











  • 2




    Please show how you are running the script.
    – l0b0
    2 days ago










  • like when run script like bash script.sh it runs but when i use sudo and run it doesnt
    – Prinz Piuz
    yesterday






  • 2




    by "it doesn't" do you mean it "doesn't run and I get a sudo error", or "it doesn't run and emits THIS error" or what?
    – Jeff Schaller
    yesterday






  • 1




    did you keep $XAUTHORITY when becoming root?
    – A.B
    yesterday










  • Why would you want to run this as root? It's supposed to notify your user, right? Root can't connect to the X server you'r running, which is why it doesn't work, but really why would you want this to be run s root?
    – terdon
    yesterday
















1















This question already has an answer here:




  • Using notify-send with cron

    12 answers




#!/bin/bash
export DISPLAY=:0
state=$(upower -i $(upower -e | grep BAT) | grep --color=never -E "state" )
stat=${state:25:32}
batperct=$(upower -i $(upower -e | grep '/battery') | grep -E "percentage:")
bat=${batperct:24:26}
intbat=$(echo $bat | cut -d'%' -f1)
if [ "$intbat" -lt "15" -a "$stat" == "discharging" ]; then
notify-send 'battery low..! please plugin charger..... charge is only' "$intbat"
fi


The script runs fine when run as a normal user (bash script.sh). The desktop notification is displayed.



If I run it as root with sudo bash script.sh, the desktop notification is not displayed.



How can I use notify-send to notify users as root?



I am using Arch Linux.










share|improve this question









New contributor




Prinz Piuz is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.











marked as duplicate by roaima, RalfFriedl, terdon shell-script
Users with the  shell-script badge can single-handedly close shell-script questions as duplicates and reopen them as needed.

StackExchange.ready(function() {
if (StackExchange.options.isMobile) return;

$('.dupe-hammer-message-hover:not(.hover-bound)').each(function() {
var $hover = $(this).addClass('hover-bound'),
$msg = $hover.siblings('.dupe-hammer-message');

$hover.hover(
function() {
$hover.showInfoMessage('', {
messageElement: $msg.clone().show(),
transient: false,
position: { my: 'bottom left', at: 'top center', offsetTop: -7 },
dismissable: false,
relativeToBody: true
});
},
function() {
StackExchange.helpers.removeMessages();
}
);
});
});
19 hours ago


This question has been asked before and already has an answer. If those answers do not fully address your question, please ask a new question.











  • 2




    Please show how you are running the script.
    – l0b0
    2 days ago










  • like when run script like bash script.sh it runs but when i use sudo and run it doesnt
    – Prinz Piuz
    yesterday






  • 2




    by "it doesn't" do you mean it "doesn't run and I get a sudo error", or "it doesn't run and emits THIS error" or what?
    – Jeff Schaller
    yesterday






  • 1




    did you keep $XAUTHORITY when becoming root?
    – A.B
    yesterday










  • Why would you want to run this as root? It's supposed to notify your user, right? Root can't connect to the X server you'r running, which is why it doesn't work, but really why would you want this to be run s root?
    – terdon
    yesterday














1












1








1








This question already has an answer here:




  • Using notify-send with cron

    12 answers




#!/bin/bash
export DISPLAY=:0
state=$(upower -i $(upower -e | grep BAT) | grep --color=never -E "state" )
stat=${state:25:32}
batperct=$(upower -i $(upower -e | grep '/battery') | grep -E "percentage:")
bat=${batperct:24:26}
intbat=$(echo $bat | cut -d'%' -f1)
if [ "$intbat" -lt "15" -a "$stat" == "discharging" ]; then
notify-send 'battery low..! please plugin charger..... charge is only' "$intbat"
fi


The script runs fine when run as a normal user (bash script.sh). The desktop notification is displayed.



If I run it as root with sudo bash script.sh, the desktop notification is not displayed.



How can I use notify-send to notify users as root?



I am using Arch Linux.










share|improve this question









New contributor




Prinz Piuz is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.












This question already has an answer here:




  • Using notify-send with cron

    12 answers




#!/bin/bash
export DISPLAY=:0
state=$(upower -i $(upower -e | grep BAT) | grep --color=never -E "state" )
stat=${state:25:32}
batperct=$(upower -i $(upower -e | grep '/battery') | grep -E "percentage:")
bat=${batperct:24:26}
intbat=$(echo $bat | cut -d'%' -f1)
if [ "$intbat" -lt "15" -a "$stat" == "discharging" ]; then
notify-send 'battery low..! please plugin charger..... charge is only' "$intbat"
fi


The script runs fine when run as a normal user (bash script.sh). The desktop notification is displayed.



If I run it as root with sudo bash script.sh, the desktop notification is not displayed.



How can I use notify-send to notify users as root?



I am using Arch Linux.





This question already has an answer here:




  • Using notify-send with cron

    12 answers








bash shell-script d-bus






share|improve this question









New contributor




Prinz Piuz is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.











share|improve this question









New contributor




Prinz Piuz is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.









share|improve this question




share|improve this question








edited yesterday









Ralf

2305




2305






New contributor




Prinz Piuz is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.









asked 2 days ago









Prinz Piuz

61




61




New contributor




Prinz Piuz is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.





New contributor





Prinz Piuz is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.






Prinz Piuz is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.




marked as duplicate by roaima, RalfFriedl, terdon shell-script
Users with the  shell-script badge can single-handedly close shell-script questions as duplicates and reopen them as needed.

StackExchange.ready(function() {
if (StackExchange.options.isMobile) return;

$('.dupe-hammer-message-hover:not(.hover-bound)').each(function() {
var $hover = $(this).addClass('hover-bound'),
$msg = $hover.siblings('.dupe-hammer-message');

$hover.hover(
function() {
$hover.showInfoMessage('', {
messageElement: $msg.clone().show(),
transient: false,
position: { my: 'bottom left', at: 'top center', offsetTop: -7 },
dismissable: false,
relativeToBody: true
});
},
function() {
StackExchange.helpers.removeMessages();
}
);
});
});
19 hours ago


This question has been asked before and already has an answer. If those answers do not fully address your question, please ask a new question.






marked as duplicate by roaima, RalfFriedl, terdon shell-script
Users with the  shell-script badge can single-handedly close shell-script questions as duplicates and reopen them as needed.

StackExchange.ready(function() {
if (StackExchange.options.isMobile) return;

$('.dupe-hammer-message-hover:not(.hover-bound)').each(function() {
var $hover = $(this).addClass('hover-bound'),
$msg = $hover.siblings('.dupe-hammer-message');

$hover.hover(
function() {
$hover.showInfoMessage('', {
messageElement: $msg.clone().show(),
transient: false,
position: { my: 'bottom left', at: 'top center', offsetTop: -7 },
dismissable: false,
relativeToBody: true
});
},
function() {
StackExchange.helpers.removeMessages();
}
);
});
});
19 hours ago


This question has been asked before and already has an answer. If those answers do not fully address your question, please ask a new question.










  • 2




    Please show how you are running the script.
    – l0b0
    2 days ago










  • like when run script like bash script.sh it runs but when i use sudo and run it doesnt
    – Prinz Piuz
    yesterday






  • 2




    by "it doesn't" do you mean it "doesn't run and I get a sudo error", or "it doesn't run and emits THIS error" or what?
    – Jeff Schaller
    yesterday






  • 1




    did you keep $XAUTHORITY when becoming root?
    – A.B
    yesterday










  • Why would you want to run this as root? It's supposed to notify your user, right? Root can't connect to the X server you'r running, which is why it doesn't work, but really why would you want this to be run s root?
    – terdon
    yesterday














  • 2




    Please show how you are running the script.
    – l0b0
    2 days ago










  • like when run script like bash script.sh it runs but when i use sudo and run it doesnt
    – Prinz Piuz
    yesterday






  • 2




    by "it doesn't" do you mean it "doesn't run and I get a sudo error", or "it doesn't run and emits THIS error" or what?
    – Jeff Schaller
    yesterday






  • 1




    did you keep $XAUTHORITY when becoming root?
    – A.B
    yesterday










  • Why would you want to run this as root? It's supposed to notify your user, right? Root can't connect to the X server you'r running, which is why it doesn't work, but really why would you want this to be run s root?
    – terdon
    yesterday








2




2




Please show how you are running the script.
– l0b0
2 days ago




Please show how you are running the script.
– l0b0
2 days ago












like when run script like bash script.sh it runs but when i use sudo and run it doesnt
– Prinz Piuz
yesterday




like when run script like bash script.sh it runs but when i use sudo and run it doesnt
– Prinz Piuz
yesterday




2




2




by "it doesn't" do you mean it "doesn't run and I get a sudo error", or "it doesn't run and emits THIS error" or what?
– Jeff Schaller
yesterday




by "it doesn't" do you mean it "doesn't run and I get a sudo error", or "it doesn't run and emits THIS error" or what?
– Jeff Schaller
yesterday




1




1




did you keep $XAUTHORITY when becoming root?
– A.B
yesterday




did you keep $XAUTHORITY when becoming root?
– A.B
yesterday












Why would you want to run this as root? It's supposed to notify your user, right? Root can't connect to the X server you'r running, which is why it doesn't work, but really why would you want this to be run s root?
– terdon
yesterday




Why would you want to run this as root? It's supposed to notify your user, right? Root can't connect to the X server you'r running, which is why it doesn't work, but really why would you want this to be run s root?
– terdon
yesterday










1 Answer
1






active

oldest

votes


















1














The command notify-send needs the environment variable DBUS_SESSION_BUS_ADDRESS set and must be called with the owner of this session bus as user.



In the following script the function notify_users searches for all dbus-daemons that control a session bus. The command line of such a daemon looks like this:



dbus-daemon --fork --session --address=unix:abstract=/tmp/dbus-ceVHx19Kiy


For this processes the owner and the dbus address is determined. Then we are able to use notify-send. This script should inform all user logged in with a GDM session. But I never tested that.



Note: If you call this as non-root, you might get queried for a password due to the use of sudo.



#!/bin/bash

# Inform all logged on users
# Usage: notify_users TITLE MESSAGE [urgency [icon]]
notify_users()
{
typeset title="$1"
typeset message="$2"
typeset urgency="${3:-critical}"
typeset icon="${4:-}"

case "$urgency" in
"low") : ;;
"normal") : ;;
"critical") : ;;
*)
urgency="normal"
;;
esac

typeset ls user bus_addr

typeset IFS=$'n'

# for all dbus-daemon processes that create a session bus
for ln in "$(ps -eo user,args | grep "dbus-daemon.*--session.*--address=" | grep -v grep)"; do
# get the user name
user="$(echo "$ln" | cut -d' ' -f 1)"
# get dbus address
bus_addr="$(echo "$ln" | sed 's/^.*--address=//;s/ .*$//')"
# run notify-send with the correct user
DBUS_SESSION_BUS_ADDRESS="$bus_addr" sudo -u $user -E /usr/bin/notify-send -u "$urgency" -i "$icon" "$title" "$message"
done
}

state="$(upower -i $(upower -e | grep BAT))"

# if the state contains the word "discharging"
if [[ "$state" = *discharging* ]]; then

perc=$(echo "$state" | grep "percentage" | awk '{print $2}' | tr -d '%')

icon="$(echo "$state" | grep "icon-name:" | awk '{print $2}' | tr -d "'"" )"

if [ "$perc" -lt 15 ]; then
notify_users "Battery Low!" "Please plugin charger ... charge is only $perc%" "critical" "$icon"
fi
fi





share|improve this answer










New contributor




Ralf is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.


















  • what my i aim is to run my script as system deamon this is my .service file [Unit] Description=Battery Indicator [Service] ExecStart=/bin/bash /home/prinzpiuz/GitHub/myScripts/shell/bat Restart=on-failure [Install] WantedBy=multi-user.target but i am getting error like (code=exited, status=127)
    – Prinz Piuz
    yesterday










  • First: 127 means "command not found". Second: This script is no daemon, so it makes no sense to start it as a service. It might be used to be started as a cronjob, say every 5 minutes. Third: You should create a separate question. Last: See here and here.
    – Ralf
    yesterday


















1 Answer
1






active

oldest

votes








1 Answer
1






active

oldest

votes









active

oldest

votes






active

oldest

votes









1














The command notify-send needs the environment variable DBUS_SESSION_BUS_ADDRESS set and must be called with the owner of this session bus as user.



In the following script the function notify_users searches for all dbus-daemons that control a session bus. The command line of such a daemon looks like this:



dbus-daemon --fork --session --address=unix:abstract=/tmp/dbus-ceVHx19Kiy


For this processes the owner and the dbus address is determined. Then we are able to use notify-send. This script should inform all user logged in with a GDM session. But I never tested that.



Note: If you call this as non-root, you might get queried for a password due to the use of sudo.



#!/bin/bash

# Inform all logged on users
# Usage: notify_users TITLE MESSAGE [urgency [icon]]
notify_users()
{
typeset title="$1"
typeset message="$2"
typeset urgency="${3:-critical}"
typeset icon="${4:-}"

case "$urgency" in
"low") : ;;
"normal") : ;;
"critical") : ;;
*)
urgency="normal"
;;
esac

typeset ls user bus_addr

typeset IFS=$'n'

# for all dbus-daemon processes that create a session bus
for ln in "$(ps -eo user,args | grep "dbus-daemon.*--session.*--address=" | grep -v grep)"; do
# get the user name
user="$(echo "$ln" | cut -d' ' -f 1)"
# get dbus address
bus_addr="$(echo "$ln" | sed 's/^.*--address=//;s/ .*$//')"
# run notify-send with the correct user
DBUS_SESSION_BUS_ADDRESS="$bus_addr" sudo -u $user -E /usr/bin/notify-send -u "$urgency" -i "$icon" "$title" "$message"
done
}

state="$(upower -i $(upower -e | grep BAT))"

# if the state contains the word "discharging"
if [[ "$state" = *discharging* ]]; then

perc=$(echo "$state" | grep "percentage" | awk '{print $2}' | tr -d '%')

icon="$(echo "$state" | grep "icon-name:" | awk '{print $2}' | tr -d "'"" )"

if [ "$perc" -lt 15 ]; then
notify_users "Battery Low!" "Please plugin charger ... charge is only $perc%" "critical" "$icon"
fi
fi





share|improve this answer










New contributor




Ralf is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.


















  • what my i aim is to run my script as system deamon this is my .service file [Unit] Description=Battery Indicator [Service] ExecStart=/bin/bash /home/prinzpiuz/GitHub/myScripts/shell/bat Restart=on-failure [Install] WantedBy=multi-user.target but i am getting error like (code=exited, status=127)
    – Prinz Piuz
    yesterday










  • First: 127 means "command not found". Second: This script is no daemon, so it makes no sense to start it as a service. It might be used to be started as a cronjob, say every 5 minutes. Third: You should create a separate question. Last: See here and here.
    – Ralf
    yesterday
















1














The command notify-send needs the environment variable DBUS_SESSION_BUS_ADDRESS set and must be called with the owner of this session bus as user.



In the following script the function notify_users searches for all dbus-daemons that control a session bus. The command line of such a daemon looks like this:



dbus-daemon --fork --session --address=unix:abstract=/tmp/dbus-ceVHx19Kiy


For this processes the owner and the dbus address is determined. Then we are able to use notify-send. This script should inform all user logged in with a GDM session. But I never tested that.



Note: If you call this as non-root, you might get queried for a password due to the use of sudo.



#!/bin/bash

# Inform all logged on users
# Usage: notify_users TITLE MESSAGE [urgency [icon]]
notify_users()
{
typeset title="$1"
typeset message="$2"
typeset urgency="${3:-critical}"
typeset icon="${4:-}"

case "$urgency" in
"low") : ;;
"normal") : ;;
"critical") : ;;
*)
urgency="normal"
;;
esac

typeset ls user bus_addr

typeset IFS=$'n'

# for all dbus-daemon processes that create a session bus
for ln in "$(ps -eo user,args | grep "dbus-daemon.*--session.*--address=" | grep -v grep)"; do
# get the user name
user="$(echo "$ln" | cut -d' ' -f 1)"
# get dbus address
bus_addr="$(echo "$ln" | sed 's/^.*--address=//;s/ .*$//')"
# run notify-send with the correct user
DBUS_SESSION_BUS_ADDRESS="$bus_addr" sudo -u $user -E /usr/bin/notify-send -u "$urgency" -i "$icon" "$title" "$message"
done
}

state="$(upower -i $(upower -e | grep BAT))"

# if the state contains the word "discharging"
if [[ "$state" = *discharging* ]]; then

perc=$(echo "$state" | grep "percentage" | awk '{print $2}' | tr -d '%')

icon="$(echo "$state" | grep "icon-name:" | awk '{print $2}' | tr -d "'"" )"

if [ "$perc" -lt 15 ]; then
notify_users "Battery Low!" "Please plugin charger ... charge is only $perc%" "critical" "$icon"
fi
fi





share|improve this answer










New contributor




Ralf is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.


















  • what my i aim is to run my script as system deamon this is my .service file [Unit] Description=Battery Indicator [Service] ExecStart=/bin/bash /home/prinzpiuz/GitHub/myScripts/shell/bat Restart=on-failure [Install] WantedBy=multi-user.target but i am getting error like (code=exited, status=127)
    – Prinz Piuz
    yesterday










  • First: 127 means "command not found". Second: This script is no daemon, so it makes no sense to start it as a service. It might be used to be started as a cronjob, say every 5 minutes. Third: You should create a separate question. Last: See here and here.
    – Ralf
    yesterday














1












1








1






The command notify-send needs the environment variable DBUS_SESSION_BUS_ADDRESS set and must be called with the owner of this session bus as user.



In the following script the function notify_users searches for all dbus-daemons that control a session bus. The command line of such a daemon looks like this:



dbus-daemon --fork --session --address=unix:abstract=/tmp/dbus-ceVHx19Kiy


For this processes the owner and the dbus address is determined. Then we are able to use notify-send. This script should inform all user logged in with a GDM session. But I never tested that.



Note: If you call this as non-root, you might get queried for a password due to the use of sudo.



#!/bin/bash

# Inform all logged on users
# Usage: notify_users TITLE MESSAGE [urgency [icon]]
notify_users()
{
typeset title="$1"
typeset message="$2"
typeset urgency="${3:-critical}"
typeset icon="${4:-}"

case "$urgency" in
"low") : ;;
"normal") : ;;
"critical") : ;;
*)
urgency="normal"
;;
esac

typeset ls user bus_addr

typeset IFS=$'n'

# for all dbus-daemon processes that create a session bus
for ln in "$(ps -eo user,args | grep "dbus-daemon.*--session.*--address=" | grep -v grep)"; do
# get the user name
user="$(echo "$ln" | cut -d' ' -f 1)"
# get dbus address
bus_addr="$(echo "$ln" | sed 's/^.*--address=//;s/ .*$//')"
# run notify-send with the correct user
DBUS_SESSION_BUS_ADDRESS="$bus_addr" sudo -u $user -E /usr/bin/notify-send -u "$urgency" -i "$icon" "$title" "$message"
done
}

state="$(upower -i $(upower -e | grep BAT))"

# if the state contains the word "discharging"
if [[ "$state" = *discharging* ]]; then

perc=$(echo "$state" | grep "percentage" | awk '{print $2}' | tr -d '%')

icon="$(echo "$state" | grep "icon-name:" | awk '{print $2}' | tr -d "'"" )"

if [ "$perc" -lt 15 ]; then
notify_users "Battery Low!" "Please plugin charger ... charge is only $perc%" "critical" "$icon"
fi
fi





share|improve this answer










New contributor




Ralf is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.









The command notify-send needs the environment variable DBUS_SESSION_BUS_ADDRESS set and must be called with the owner of this session bus as user.



In the following script the function notify_users searches for all dbus-daemons that control a session bus. The command line of such a daemon looks like this:



dbus-daemon --fork --session --address=unix:abstract=/tmp/dbus-ceVHx19Kiy


For this processes the owner and the dbus address is determined. Then we are able to use notify-send. This script should inform all user logged in with a GDM session. But I never tested that.



Note: If you call this as non-root, you might get queried for a password due to the use of sudo.



#!/bin/bash

# Inform all logged on users
# Usage: notify_users TITLE MESSAGE [urgency [icon]]
notify_users()
{
typeset title="$1"
typeset message="$2"
typeset urgency="${3:-critical}"
typeset icon="${4:-}"

case "$urgency" in
"low") : ;;
"normal") : ;;
"critical") : ;;
*)
urgency="normal"
;;
esac

typeset ls user bus_addr

typeset IFS=$'n'

# for all dbus-daemon processes that create a session bus
for ln in "$(ps -eo user,args | grep "dbus-daemon.*--session.*--address=" | grep -v grep)"; do
# get the user name
user="$(echo "$ln" | cut -d' ' -f 1)"
# get dbus address
bus_addr="$(echo "$ln" | sed 's/^.*--address=//;s/ .*$//')"
# run notify-send with the correct user
DBUS_SESSION_BUS_ADDRESS="$bus_addr" sudo -u $user -E /usr/bin/notify-send -u "$urgency" -i "$icon" "$title" "$message"
done
}

state="$(upower -i $(upower -e | grep BAT))"

# if the state contains the word "discharging"
if [[ "$state" = *discharging* ]]; then

perc=$(echo "$state" | grep "percentage" | awk '{print $2}' | tr -d '%')

icon="$(echo "$state" | grep "icon-name:" | awk '{print $2}' | tr -d "'"" )"

if [ "$perc" -lt 15 ]; then
notify_users "Battery Low!" "Please plugin charger ... charge is only $perc%" "critical" "$icon"
fi
fi






share|improve this answer










New contributor




Ralf is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.









share|improve this answer



share|improve this answer








edited yesterday





















New contributor




Ralf is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.









answered yesterday









Ralf

2305




2305




New contributor




Ralf is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.





New contributor





Ralf is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.






Ralf is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.












  • what my i aim is to run my script as system deamon this is my .service file [Unit] Description=Battery Indicator [Service] ExecStart=/bin/bash /home/prinzpiuz/GitHub/myScripts/shell/bat Restart=on-failure [Install] WantedBy=multi-user.target but i am getting error like (code=exited, status=127)
    – Prinz Piuz
    yesterday










  • First: 127 means "command not found". Second: This script is no daemon, so it makes no sense to start it as a service. It might be used to be started as a cronjob, say every 5 minutes. Third: You should create a separate question. Last: See here and here.
    – Ralf
    yesterday


















  • what my i aim is to run my script as system deamon this is my .service file [Unit] Description=Battery Indicator [Service] ExecStart=/bin/bash /home/prinzpiuz/GitHub/myScripts/shell/bat Restart=on-failure [Install] WantedBy=multi-user.target but i am getting error like (code=exited, status=127)
    – Prinz Piuz
    yesterday










  • First: 127 means "command not found". Second: This script is no daemon, so it makes no sense to start it as a service. It might be used to be started as a cronjob, say every 5 minutes. Third: You should create a separate question. Last: See here and here.
    – Ralf
    yesterday
















what my i aim is to run my script as system deamon this is my .service file [Unit] Description=Battery Indicator [Service] ExecStart=/bin/bash /home/prinzpiuz/GitHub/myScripts/shell/bat Restart=on-failure [Install] WantedBy=multi-user.target but i am getting error like (code=exited, status=127)
– Prinz Piuz
yesterday




what my i aim is to run my script as system deamon this is my .service file [Unit] Description=Battery Indicator [Service] ExecStart=/bin/bash /home/prinzpiuz/GitHub/myScripts/shell/bat Restart=on-failure [Install] WantedBy=multi-user.target but i am getting error like (code=exited, status=127)
– Prinz Piuz
yesterday












First: 127 means "command not found". Second: This script is no daemon, so it makes no sense to start it as a service. It might be used to be started as a cronjob, say every 5 minutes. Third: You should create a separate question. Last: See here and here.
– Ralf
yesterday




First: 127 means "command not found". Second: This script is no daemon, so it makes no sense to start it as a service. It might be used to be started as a cronjob, say every 5 minutes. Third: You should create a separate question. Last: See here and here.
– Ralf
yesterday



Popular posts from this blog

How to make a Squid Proxy server?

第一次世界大戦

Touch on Surface Book