ネットワークプリンタに接続するには、Cupsを再起動する必要があります。

ネットワークプリンタに接続するには、Cupsを再起動する必要があります。

時々(一時停止または起動から再開した後は必ずしもそうではありません)、sudo /etc/init.d/cups restartネットワークプリンタをもう一度見てください。このプロセスをバイパスする方法はありますか?それともLubuntu 16.04で自動化する最良の方法は何ですか?

ベストアンサー1

Linuxベースのシェルスクリプトの場合は、次のようにスクリプトを並べ替えることができます。

クローンタブ項目:

*/5 * * * * sh /scripts/cups_recursive_checking.sh
#/bin/sh
HOST='server-name'

/etc/init.d/cups status>/scripts/cups.txt

if grep "cupsd (pid " /scripts/cups.txt
then
    echo "cups is already running"
    exit
else
    /etc/init.d/cups restart
    echo "cups just now started in server-name"

    ############# For mail Notification whenever cups gets restart follow below line according to your email ##########

    mutt -e "my_hdr Content-Type: text/html" -e 'set realname=Notification' \
                    -e 'set [email protected]' [email protected] \
                    -s "CUPS Notification" < /scripts/cups.txt
fi
###END OF THE SCRIPT###

例: Linuxでカップを再起動した後のプリンタの確認

lpstat -a

clientPrinter accepting requests since Sat 13 Jul 2019 10:07:01 AM IST

dmx accepting requests since Sat 13 Jul 2019 03:55:05 PM IST

HP_LaserJet_400_M401dw accepting requests since Sat 13 Jul 2019 03:05:06 PM IST

おすすめ記事