systemd作业失败没有这样的文件或目录

时间:2018-05-02 01:47:49

标签: linux systemd

一直试图按照此脚本启动气流

https://linuxconfig.org/how-to-automatically-execute-shell-script-at-startup-boot-on-systemd-linux

所以我在/usr/local/bin/airflow-start-all.sh中有以下sh文件

#!/bin/bash
echo "starting up postgres service"
export AIRFLOW_HOME=~/airflow
sudo service postgresql start
echo "sleeping"
sleep 15
echo "initiating database"
airflow initdb
echo "sleeping"
sleep 15
gnome-terminal -e /home/ubuntu/Source/Bash/airflow-start-webserver.sh
sleep 15
echo "starting rabbitmq service"
sudo service rabbitmq-server start
sleep 15
gnome-terminal -e /home/ubuntu/Source/Bash/airflow-start-scheduler.sh
sleep 15
gnome-terminal -e /home/ubuntu/Source/Bash/airflow-start-worker.sh

和/etc/systemd/system/airflow-start-service.service中的以下文件

[Unit]
Description=My last command
After=default.target

[Service]
ExecStart=/usr/local/bin/airflow-start-all.sh

[Install]
WantedBy=default.target

我跑了

sudo chmod 744 /usr/local/bin/airflow-start-all.sh

sudo chmod 664 /etc/systemd/system/airflow-service-start.service

以及

systemctl daemon-reload
systemctl enable disk-space-check.service

它似乎并没有在启动时启动服务 - 我得到的只是:

● airflow-service-start.service - My last command
   Loaded: loaded (/etc/systemd/system/airflow-service-start.service; enabled; vendor preset: enabled)
   Active: failed (Result: exit-code) since Wed 2018-05-02 00:23:00 UTC; 1h 21min ago
  Process: 1587 ExecStart=/usr/local/bin/airflow-start-all.sh (code=exited, status=1/FAILURE)
 Main PID: 1587 (code=exited, status=1/FAILURE)

May 02 00:22:30 sudo[1658]: pam_unix(sudo:session): session closed for user root
May 02 00:22:45 airflow-start-all.sh[1587]: Failed to connect to Mir: Failed to connect to server socket: No such file or directory
May 02 00:22:45 airflow-start-all.sh[1587]: Unable to init server: Could not connect: Connection refused
May 02 00:22:45  airflow-start-all.sh[1587]: Failed to parse arguments: Cannot open display:
May 02 00:23:00 airflow-start-all.sh[1587]: Failed to connect to Mir: Failed to connect to server socket: No such file or directory
May 02 00:23:00 airflow-start-all.sh[1587]: Unable to init server: Could not connect: Connection refused
May 02 00:23:00 airflow-start-all.sh[1587]: Failed to parse arguments: Cannot open display:
May 02 00:23:00  systemd[1]: airflow-service-start.service: Main process exited, code=exited, status=1/FAILURE
May 02 00:23:00  systemd[1]: airflow-service-start.service: Unit entered failed state.
May 02 00:23:00  systemd[1]: airflow-service-start.service: Failed with result 'exit-code'.

知道我哪里出错了?

谢谢, 添

0 个答案:

没有答案