Henrique-RJ
(usa Outra)
Enviado em 06/10/2018 - 10:22h
Ryuk escreveu:
Qual é a dúvida?
Descreva o que pretende executar com o cron e porque não conseguiu (mensagens de erro, se possível). Mostre o conteúdo do script, se for o caso!!!
Sem nenhuma informação útil ninguém vai poder te ajudar :\
O que tento executar no cron são os seguintes dois scripts como executáveis em root:
removersombrapainel.sh
#!/bin/bash
for WID in `xwininfo -root -tree | sed '/"plasma-desktop": ("Plasma" "Plasma")/!d; s/^ *\([^ ]*\) .*/\1/g'`; do
xprop -id $WID -remove _KDE_NET_WM_SHADOW
done
conky.sh
#!/bin/bash
/usr/bin/conky
Então abro o terminal em modo root e executo os seguintes comandos que não resolvem:
Exemplo 1
#crontab
#@reboot >> /home/henrique/removersombrapainel.sh
#@reboot >> /home/henrique/conky.sh
Exemplo 2
#crontab
#* * * * * reboot root >> /home/henrique/removersombrapainel.sh
#* * * * * reboot root >> /home/henrique/conky.sh
Exemplo 3
#crontab
#* * * * * reboot root /home/henrique/removersombrapainel.sh
#* * * * * reboot root /home/henrique/conky.sh
Exemplo 4
#crontab
#@reboot /home/henrique/removersombrapainel.sh
#@reboot /home/henrique/conky.sh
Todos esses comandos acima geram direitinho um arquivo em modo root em /var/spool/cron/crontabs mas quando reinicio o sistema os scripts não são executados.
Em /etc/init.d/cron editei o código original desse script acrescentando no final dele os caminhos para esses scripts e também não deu certo:
#!/bin/sh -e
# upstart-job
#
# Symlink target for initscripts that have been converted to Upstart.
set -e
UPSTART_JOB_CONF="/etc/default/upstart-job"
INITSCRIPT="$(basename "$0")"
JOB="${INITSCRIPT%.sh}"
if [ "$JOB" = "upstart-job" ]; then
if [ -z "$1" ]; then
echo "Usage: upstart-job JOB COMMAND" 1>&2
exit 1
fi
JOB="$1"
INITSCRIPT="$1"
shift
else
if [ -z "$1" ]; then
echo "Usage: $0 COMMAND" 1>&2
exit 1
fi
fi
COMMAND="$1"
shift
ECHO=echo
ECHO_ERROR=echo
if [ -e "$UPSTART_JOB_CONF" ]; then
. "$UPSTART_JOB_CONF"
fi
if [ -n "$DPKG_MAINTSCRIPT_PACKAGE" ]; then
ECHO=:
ECHO_ERROR=:
fi
$ECHO "Rather than invoking init scripts through /etc/init.d, use the service(8)"
$ECHO "utility, e.g. service $INITSCRIPT $COMMAND"
# Only check if jobs are disabled if the currently _running_ version of
# Upstart (which may be older than the latest _installed_ version)
# supports such a query.
#
# This check is necessary to handle the scenario when upgrading from a
# release without the 'show-config' command (introduced in
# Upstart for Ubuntu version 0.9.7) since without this check, all
# installed packages with associated Upstart jobs would be considered
# disabled.
#
# Once Upstart can maintain state on re-exec, this change can be
# dropped (since the currently running version of Upstart will always
# match the latest installed version).
UPSTART_VERSION_RUNNING=$(initctl version|awk '{print $3}'|tr -d ')')
if dpkg --compare-versions "$UPSTART_VERSION_RUNNING" ge 0.9.7
then
initctl show-config -e "$JOB"|grep -q '^ start on' || DISABLED=1
fi
case $COMMAND in
status)
$ECHO
$ECHO "Since the script you are attempting to invoke has been converted to an"
$ECHO "Upstart job, you may also use the $COMMAND(8) utility, e.g. $COMMAND $JOB"
$COMMAND "$JOB"
;;
start|stop)
$ECHO
$ECHO "Since the script you are attempting to invoke has been converted to an"
$ECHO "Upstart job, you may also use the $COMMAND(8) utility, e.g. $COMMAND $JOB"
if status "$JOB" 2>/dev/null | grep -q ' start/'; then
RUNNING=1
fi
if [ -z "$RUNNING" ] && [ "$COMMAND" = "stop" ]; then
exit 0
elif [ -n "$RUNNING" ] && [ "$COMMAND" = "start" ]; then
exit 0
elif [ -n "$DISABLED" ] && [ "$COMMAND" = "start" ]; then
exit 0
fi
$COMMAND "$JOB"
;;
restart)
$ECHO
$ECHO "Since the script you are attempting to invoke has been converted to an"
$ECHO "Upstart job, you may also use the stop(8) and then start(8) utilities,"
$ECHO "e.g. stop $JOB ; start $JOB. The restart(8) utility is also available."
if status "$JOB" 2>/dev/null | grep -q ' start/'; then
RUNNING=1
fi
if [ -n "$RUNNING" ] ; then
stop "$JOB"
fi
# If the job is disabled and is not currently running, the job is
# not restarted. However, if the job is disabled but has been forced into the
# running state, we *do* stop and restart it since this is expected behaviour
# for the admin who forced the start.
if [ -n "$DISABLED" ] && [ -z "$RUNNING" ]; then
exit 0
fi
start "$JOB"
;;
reload|force-reload)
$ECHO
$ECHO "Since the script you are attempting to invoke has been converted to an"
$ECHO "Upstart job, you may also use the reload(8) utility, e.g. reload $JOB"
reload "$JOB"
;;
*)
$ECHO_ERROR
$ECHO_ERROR "The script you are attempting to invoke has been converted to an Upstart" 1>&2
$ECHO_ERROR "job, but $COMMAND is not supported for Upstart jobs." 1>&2
exit 1
esac
/home/henrique/removersombrapainel.sh
/home/henrique/conky.sh
" O que habita no esconderijo do Altíssimo e descansa à sombra do Onipotente diz ao Senhor: Meu refúgio e meu baluarte, Deus meu, em quem confio." Salmos 91:1-2