Quantcast
Image

Search Results for: start

How to automatically run program on GNOME startup

By  •  November 28, 2023

You can configure applications or scripts to execute when logging in to your GNOME session. If you require your application or script to launch regardless of your desktop environment …
Read More

How to set up Apache to start automatically on macOS boot

By  •  November 28, 2023

Running a web server on your local machine can be incredibly useful for development, testing, or even hosting personal projects. Apache is a popular web server software that runs …
Read More

How to test Apache configuration without restarting the service

By  •  November 21, 2023

It’s always a good idea to test your newly updated Apache config file before restarting the service itself. This will help avoid downtime due to Apache refusing to start due to misconfiguration. You can use apachectl, httpd or equivalent binaries as in the examples below;

Different platform might use different binary names such as apache, apache2 or apache2ctl

  1. httpd

    # httpd -t
    AH00112: Warning: DocumentRoot [/var/www/mywebsite] does not exist
    AH00558: httpd: Could not reliably determine the server's fully qualified domain name, using 127.0.0.1. Set the 'ServerName' directive globally to suppress this message
    Syntax OK
  2. apachectl

    # apachectl configtest
    AH00112: Warning: DocumentRoot [/var/www/mywebsite] does not exist
    AH00558: httpd: Could not reliably determine the server's fully qualified domain name, using 127.0.0.1. Set the 'ServerName' directive globally to suppress this message
    Syntax OK

What happens is that the programs will try to parse the configuration files without implementing any of your changes. Once you get Syntax OK at the end of the output and are satisfied with all the warnings (if any), you could confidently restart your Apache service.

How to restart MySQL service

By  •  May 28, 2023

Replace mysql with mysqld for RedHat-based platforms.

Ubuntu 16.10 and later, RedHat/CentOS 7 and later, fedora and other platform with systemd

sudo systemctl restart mysql.service

Older platforms with System V init scripts

sudo /etc/init.d/mysql restart

Platforms with service command. Normally a wrapper to System V init scripts or systemd commands.

sudo sudo service mysql restart

How to automatically run program on KDE startup

By  •  May 28, 2023

KDE looks for programs in the ~/.kde/Autostart directory to be executed during it’s startup. The way to execute programs as KDE starts would be to;

  1. Copy programs directly to the directory
  2. Create (soft) link to programs from the directory
  3. Create a script which will execute other programs

The first method is very straightforward, and the second method can be achieved using the ln command. The following example is to run superkaramba as KDE starts.

$ cd ~/.kde/Autostart/
$ ln -s /usr/bin/superkaramba mykaramba

The third option is my personal favorite, as it provides a great level of flexibility. The following is an example bash script placed in the ~/.kde/Autostart/ directory to run gpg-agent, export a variable, and start the program katapult and conky;

#!/bin/bash
 
/usr/bin/gpg-agent --daemon --use-standard-socket &
export GPG_AGENT_INFO=/home/shakir/.gnupg/S.gpg-agent
/usr/bin/katapult &
/usr/bin/conky &

Please make sure all programs are executable by running chmod, probably as the following example;

$ chmod +x ~/.kde/Autostart/*

How to start, restart and stop SSH server service

By  •  December 2, 2021

SSH server service by OpenSSH is normally provided by the sshd daemon. In most Unix-based operating systems, systemd, System V. Init scripts, or the service command service.


Read More

How to restart MySQL/MariaDB service

By  •  December 2, 2021

Replace mysql with mysqld for RedHat-based platforms.

Ubuntu 16.10 and later, RedHat/CentOS 7 and later, fedora and other platform with systemd

sudo systemctl restart mysql.service …
Read More

How to start with an empty session in KDE

By  •  December 2, 2021

KDE will automatically start from where the user left off in their previous session. KDE, for example, keeps track of open applications and their window positioning when a user …
Read More

How to automatically start Apache on macOS boot

By  •  December 2, 2021

Apache is installed by default on macOS, but it's not configured to start during system boot automatically. For this, you'll have to manually start the httpd process every time …
Read More

How to automatically run program on Linux startup

By  •  May 28, 2018

On Linux bootup or startup, it will first run the program init, and depending on how it is configured and the runlevel Linux is running, it will run other scripts which normally resides in the /etc/rc.d/ directory. Right before a user is presented with the login prompt, the /etc/rc.d/boot.local or /etc/rc.local script is executed.

By that we should have the idea that to execute our programs even before we’re given the login prompt is to add them to the /etc/rc.d directory, or simply edit the /etc/rc.d/boot.local or /etc/rc.local script and add few lines to make it execute our program. Running programs using the /etc/rc.d directory is actually more complicated than what I’ve mentioned so far, and so we’ll just proceed with the /etc/rc.d/boot.local or /etc/rc.local script.

In any given Linux system, only one of these 2 files actually exist. /etc/rc.local is normally used by Debian and it’s derivatives, and /etc/rc.d/boot.local used by the Redhat family of Linux distribution.

The /etc/rc.d/boot.local or /etc/rc.local scripts are actually Bash scripts, and the following is the default file for Ubuntu;

#!/bin/sh -e
#
# rc.local
#
# This script is executed at the end of each multiuser runlevel.
# Make sure that the script will "exit 0" on success or any other
# value on error.
#
# In order to enable or disable this script just change the execution
# bits.
#
# By default this script does nothing

In my case I use it to execute no-ip program, and I added the following line to the file to have it executed;

noip2 -c /var/lib/noip2/noip2.conf

That’s a very simple example to directly execute a program. Anyone with some Bash scripting knowledge can include conditional statements and whatever Bash has to offer if they need to.

Top