Skip to content

Systemd management #4

Description

@neoground

Command to add systemd service for charm instance: bob systemd.

If it exists, ask to override or remove.

Will add timer if not exists (/etc/systemd/system/charm.timer):

[Unit]
Description=Run Charm Framework cron services every minute

[Timer]
OnCalendar=*:*:0/1
Persistent=true

[Install]
WantedBy=timers.target

Will add target if not exists (/etc/systemd/system/charm.target):

[Unit]
Description=Charm Framework cron target

Will add service for specific instance if not exists (/etc/systemd/system/charm-$name.service):

[Unit]
Description=Charm Demo Website Cronjob

[Service]
User=project-user
Group=user-group
ExecStart=/path/to/php $path cron:run

And link and activate it:

# Add timer
sudo systemctl daemon-reload
sudo systemctl enable charm.timer
sudo systemctl start charm.timer

# Add service
sudo systemctl enable charm-$name.service --now
sudo systemctl add-wants charm.target charm-$name.service

# Enable target
sudo systemctl enable charm.target

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions