Skip to content

Instantly share code, notes, and snippets.

@im-noob
Created October 15, 2023 14:21
Show Gist options
  • Save im-noob/9a65975c07e76efe566d616c7485848c to your computer and use it in GitHub Desktop.
Save im-noob/9a65975c07e76efe566d616c7485848c to your computer and use it in GitHub Desktop.
Airflow SystemCtl SystemMD Config for webserver and scheduler
# /lib/systemd/system/airflow-scheduler.service
[Unit]
Description=Airflow scheduler daemon
After=network.target postgresql.service mysql.service redis.service rabbitmq-server.service
Wants=postgresql.service mysql.service redis.service rabbitmq-server.service
[Service]
Environment="PATH=$PATH:/home/aarav/anaconda3/envs/airflow/bin"
User=aarav
Group=sudo
Type=simple
#ExecStart=/home/aarav/anaconda3/envs/airflow/bin/airflow scheduler
ExecStart=/bin/bash -c 'PATH=/home/aarav/anaconda3/envs/airflow/bin:$PATH exec /home/aarav/anaconda3/envs/airflow/bin/airflow scheduler'
Restart=always
RestartSec=5s
[Install]
WantedBy=multi-user.target
# /lib/systemd/system/airflow-webserver.service
[Unit]
Description=Airflow webserver daemon
After=network.target postgresql.service mysql.service redis.service rabbitmq-server.service
Wants=postgresql.service mysql.service redis.service rabbitmq-server.service
[Service]
Environment="PATH=$PATH:/home/aarav/anaconda3/envs/airflow/bin"
User=aarav
Group=sudo
Type=simple
ExecStart=/home/aarav/anaconda3/envs/airflow/bin/airflow webserver --pid /home/aarav/airflow/webserver.pid
Restart=on-failure
RestartSec=5s
PrivateTmp=true
[Install]
WantedBy=multi-user.target
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment