Build custom systemctl service command


Let’s create a service command in linux to execute the Laravel queue listen command.

php artisan queue:listen

Lets start šŸ™‚

STEP 1: Create bash script for Laravel php artisan queue:listen

Create a bash script queue.shĀ to any preferred location in server. I preferred to create in /root as a root user.

$ sudo su –

$ vim /root/


In file


cd /path/to/laravel/project

php artisan queue:listen


Save the file and change the file mode executable.

$ chmod +x /root/

STEP 2: Create .service

Create a service .service file named ays_queue.service.Ā 

$ sudo vimĀ  /etc/systemd/system/ays_queue.service

In ays_queue.service file

Description=AYS Laravel queue listen service

ExecStart=/bin/sh /root/


Here, ‘’ refers the service create can can be executed by any user in the system.

Now, once .service file created the system should reload the daemon.

$ systemctl daemon-reload

To verify, the system service working following commands can be executed

$ systemctl status ays_queue
$ systemctl start ays_queue
$ systemctl stop ays_queue
$ systemctl restart ays_queue

STEP 4: Check and re-start command

In advance, one more step to check the command and start the service in case of inactive.

Create a new bash file again in /root named

$ sudo vim /root/

In file


CHECKQUEUE=$(systemctl is-active ays_queue)

if [ $CHECKQUEUE = ‘active’ ]; then
echo ‘active’
systemctl restart ays_queue

Also, make file executable.

$ sudo chmod +x /root/

You can add in crontabs to check the status and restart the service in case of inactive. In this way, your service will never stops.





How I can fix ā€œAppStream cache update completed, but some metadata was ignored due to errors.”


I executed apt update as root, but I received this error message: AppStream cache update completed, but some metadata was ignored due to errors.



The bug has been fixed in appstream package version 0.10.1, but the version that gets installed in Ubuntu 16.04 is 0.9.4 by default. Ubuntu 16.10 automatically receives the update as it’s provided in its standard repositories.

The updated package version with the bugfix for Ubuntu 16.04 however is only provided through the xenial-backports repository, which has a lower priority than the others. This means it won’t upgrade to this version unless you manually specify it.

To enable the xenial-backports repository in first place, follow How do I enable the “backports” repository? (but only enable the repository, you don’t need to modify the repo priority).

After that, upgrade to the version from xenial-backports by typing:

sudo apt install appstream/xenial-backports

Now your appstream package should be upgraded to version 0.10.1.

$ appstreamcli --version
AppStream CLI tool version: 0.10.1

Now force refreshing the cache data, you should no longer see any warning:

$ sudo appstreamcli refresh --force
AppStream cache update completed successfully.

SourceĀ link: