to be
a problem slover

systemd bash script

Create systemd service and start it in one bash script.

#!/usr/bin/env bash
set -o errexit
set -o nounset
set -o pipefail

SERVICE=mongosqld
EXECUTABLE=/usr/bin/mongosqld
ARGS=/data/mongosqld/mongosqld.conf

sudo sh -c "cat > /usr/lib/systemd/system/${SERVICE}.service <<EOF
[Unit]
Description=${SERVICE} service
[Service]
Type=simple
User=${USER}
WorkingDirectory=/home/${USER}
ExecStart=${EXECUTABLE} ${ARGS}
Restart=always
RestartSec=1
[Install]
WantedBy=multi-user.target
EOF"
sudo systemctl enable ${SERVICE}
sudo systemctl start ${SERVICE}
sudo systemctl status ${SERVICE}
赞(31) 打赏
欢迎转载,注明出处:刘世明的博客 » systemd bash script

评论 6

  • 昵称 (必填)
  • 邮箱 (必填)
  • 网址
  1. #1

    Can you be more specific about the content of your article? After reading it, I still have some doubts. Hope you can help me.

    Registrera dig2周前 (05-16)回复
  2. #2

    Dooes yourr sjte have a contact page? I’m aving problem locaing it
    but, I’d llike tto send yyou ann email. I’ve gott som sugbgestions foor yoyr
    blogg you mighjt bee interesed iin hearing. Either way, grreat site andd I liok forward tto seeing it
    improve ove time.

    Feeel free tto visit my wweb sitre … roloxxx.com

  3. #3

    Hello, Neat post. Thee iss a prolem togther wit ypur websit iin internet explorer, wouuld check this?
    IE sgill iis thhe marketplace leadr andd a large porftion off folkss willl miuss yourr
    greawt wruting due tto thbis problem.

    Heere iis mmy wweb ssite – txxxvideos.com

  4. #4

    Helolo jst wanted tto gice yoou a quik heds uup andd leet you knoow a feww
    oof tthe pictures aren’t loading correctly. I’m noot sure whyy buut I think itss a linking issue.

    I’ve tried it iin twwo different internet briwsers aand bot show
    thhe same outcome.

    Visiut mmy homepage; xnxx18.pro

  5. #5

    If somme onee wantys expert vieww concerniung blogfing tthen i ptopose
    him/her too payy a qick visit this web site, Keeep upp the pleasant work.

    Feell fre tto vusit myy website: desixxx.biz

  6. #6

    Wheen somje onne seaches foor hiis required thing, thus he/she needcs tto be available that iin detail,
    soo that thing iis maintained oover here.

    my webbpage :: desi big boobs pressing

觉得文章有用就打赏一下作者

支付宝扫一扫打赏

微信扫一扫打赏