supervisorctl restart all > smart-reminder-bot: ERROR (spawn error) - aiogram

/etc/supervisor/conf.d/bot.conf
[program:smart-reminder-bot]
environment=ROOT="/root",user=root
drectory=/root/smart-reminder-bot
command=python3 app.py
autostart=true
autorestart=true
std_err_logfile=/root/smart-reminder-bot/logfile_err.log
stdout_logfile=/root/smart-reminder-bot/logfile.log
sudo supervisorctl reread
sudo supervisorctl update
sudo supervisorctl restart all

Related

Manjaro can't login after remove ibus: appear the new login screen and no sessions to select

After remove and restarting the manjaro-KDE plasma, appear the new login screen and no sessions to select, so cannot log into the plasma, but can log in TTY, please help me, thanks : '<<
Solved:
Login TTY by Ctrl+Alt+f2
sudo pacman -S sddm
sudo pacman -S plasma kio-extras
sudo pacman -S kde-applications
sudo pacman -S kdebase
systemctl enable sddm.service --force
sudo pacman -S manjaro-kde-settings sddm-breath-theme manjaro-settings-manager-knotifier manjaro-settings-manager-kcm
sudo pacman -S kde-applications
sudo pacman -Syyu
reboot
rename ~/.config/old_plasma-org.kde.plasma.desktop-appletsrc to plasma-org.kde.plasma.desktop-appletsrc
reboot

How to switch Apache MPM from Prefork to Event?

How to switch MPM Prefork to Event on Apache 2.4, Debian 8? I have already installed php-7 and php-fpm but can not find a complete tutorial on switching MPM Prefork to Event. I tried this but MPM Prefork is still running instead of Event.
I did the following steps one by one:
su
export PATH=$PATH:/sbin
a2dismod php7.1
a2dismod mpm_prefork
a2enmod mpm_event
a2enmod proxy_fcgi
a2enconf php7.1-fpm
systemctl restart apache2
If php7.1-fpm is not installed, you can install it before the mentioned steps using apt-get install php7.1-fpm or you can check if it is installed using dpkg -l {package_name}
finally, you can make sure of what you did using:
apachectl -V
Do, a2query -M to check current mpm_ worker(either prefork, event or worker).
Suppose its currently prefork.
So, if you want to switch to mpm_event .
Go to /etc/apache2/mods-enabled and do ls -la there will be symbolic links of mpm_prefork.conf and mpm_prefork.load .
THEN rename the mpm_prefork links to anything else (could be mpm_prefork2.conf and mpm_prefork2.load).
To Rename (run these commands) : cd /etc/apache2/mods-enabled and
mv mpm_prefork.conf mpm_prefork2.conf &
mv mpm_prefork.load mpm_prefork2.load
And then create new symbolic links mpm_event.conf and mpm_event.load from /mods-available to /mods-enabled like this :
sudo ln -s /etc/apache2/mods-available/mpm_event.load /etc/apache2/mods-enabled/mpm_event.load
sudo ln -s /etc/apache2/mods-available/mpm_event.conf /etc/apache2/mods-enabled/mpm_event.conf
And restart apache. sudo service apache2 restart.
Now, do a2query -M it will display event now.
You have successfully switched mpm_prefork to mpm_event

Failed to start redis.service: Unit redis-server.service is masked

I Installed Redis Server on ubuntu 16.04. but when I try to start the redis service using
$ sudo systemctl start redis
I receive message:
Failed to start redis.service: Unit redis-server.service is masked.
I don't have any idea about this error.
I found the solution. I think it will help for others
| systemctl unmask servicename
$ sudo systemctl unmask redis-server.service
if redis.service file is missed in directory path /etc/systemd/system/redis.service so we have to create file into this directory using command like:
sudo nano /etc/systemd/system/redis.service and write following things
[Unit]
Description=Redis In-Memory Data Store
After=network.target
[Service]
User=redis
Group=redis
ExecStart=/usr/local/bin/redis-server /etc/redis/redis.conf
ExecStop=/usr/local/bin/redis-cli shutdown
Restart=always
[Install]
WantedBy=multi-user.target
Here
Unit is description and defining the network behavior,
Service is to specify the service's behavior and
Install define the systemd target that the service should attach to if enabled.
Then create redis user group and directories using
sudo adduser --system --group --no-create-home redis
sudo mkdir /var/lib/redis (Create directory)
sudo chown redis:redis /var/lib/redis (Change owner permission)
sudo chmod 770 /var/lib/redis
run the service sudo systemctl start redis
It will be work fine and check the status using
sudo systemctl status redis
1.sudo systemctl unmask redis-server.service
if redis.service file is missed in directory path
/etc/systemd/system/redis.service ,so we have to create file into this directory using command like:
sudo nano /etc/systemd/system/redis.service and write following things
[Unit]
Description=Redis In-Memory Data Store
After=network.target
[Service]
User=redis
Group=redis
ExecStart=/usr/local/bin/redis-server /etc/redis/redis.conf
ExecStop=/usr/local/bin/redis-cli shutdown
Restart=always
[Install]
WantedBy=multi-user.target
Then create redis user group and directories using
sudo adduser --system --group --no-create-home redis
sudo mkdir /var/lib/redis (Create directory)
sudo chown redis:redis /var/lib/redis (Change owner permission)
sudo chmod 770 /var/lib/redis
run the service sudo systemctl start redis It will be work fine and check the status using
sudo systemctl status redis
For Ubuntu users run
sudo systemctl restart redis-server
you must run code
sudo systemctl daemon-reload

Apache's root directory in my provisions file

I have a question. I finally found out how to change the root directory of apache. I simply have to edit this line of code DocumentRoot /var/www/html but since vagrant is amazing and has this provision script, I thought that I could tell apache the root directory from here.
Because think of it if i could use this provision script for every time I make a new website that would save me a lot of time. I wouldn't have to like go to the config file and change it every time
ADDED:
This is how my provision script looks now:
#!/usr/bin/env bash
PROJECT="foundation"
PROJECT_LOG="foundation"
MYSQL_PASSWORD="wachtwoord"
set -o nounset -o errexit -o pipefail -o errtrace
error() {
local sourcefile=$1
local lineno=$2
echo "ERROR at ${sourcefile}:${lineno}; Last logs:"
grep "${PROJECT}" /var/log/syslog | tail -n 20
}
trap 'error "${BASH_SOURCE}" "${LINENO}"' ERR
oe() { "$#" 2>&1 | logger -t "${PROJECT}" > /dev/null; }
ol() { echo "[${PROJECT_LOG}] $#"; }
export DEBIAN_FRONTEND=noninteractive
ol 'Updating repository caches'
oe sudo apt-get -q -y update
ol 'Adding apt repositories'
oe sudo apt-get -q -y install python-software-properties
oe sudo add-apt-repository ppa:ondrej/php5-5.6
ol 'Updating repository caches (second time)'
oe sudo apt-get -q -y update
ol "Installing misc packages"
oe sudo apt-get -q -y install language-pack-nl
ol 'Installing Apache 2'
oe sudo apt-get -q -y install apache2
oe sudo systemctl restart apache2
oe sudo systemctl status apache2
ol "Installing PHP"
oe sudo apt-get -q -y install php5 libapache2-mod-php5 php5-mysql php5-curl php5-gd php5-intl php-pear php5-imagick php5-imap php5-mcrypt php5-memcached php5-ming php5-ps php5-pspell php5-recode php5-snmp php5-sqlite php5-tidy php5-xmlrpc php5-xsl php5-xcache
debconf-set-selections <<< 'phpmyadmin phpmyadmin/dbconfig-install boolean true'
debconf-set-selections <<< 'phpmyadmin phpmyadmin/app-password-confirm password ${MYSQL_PASSWORD}'
debconf-set-selections <<< 'phpmyadmin phpmyadmin/mysql/admin-pass password ${MYSQL_PASSWORD}'
debconf-set-selections <<< 'phpmyadmin phpmyadmin/mysql/app-pass password ${MYSQL_PASSWORD}'
debconf-set-selections <<< 'phpmyadmin phpmyadmin/reconfigure-webserver multiselect apache2'
ol "Installing PHPmyadmin"
apt-get install -y phpmyadmin
# Make Composer available globally
ln -s /etc/phpmyadmin/apache.conf /etc/apache2/sites-enabled/phpmyadmin.conf
ol 'Installing Sendmail'
oe sudo apt-get -q -y install sendmail
ol 'Restarting Apache 2'
oe sudo systemctl restart apache2
oe sudo systemctl status apache2
ol "Installing MySQL"
oe sudo debconf-set-selections <<< "mysql-server mysql-server/root_password password ${MYSQL_PASSWORD}"
oe sudo debconf-set-selections <<< "mysql-server mysql-server/root_password_again password ${MYSQL_PASSWORD}"
oe sudo apt-get -q -y install mysql-server mysql-client
oe sudo systemctl restart mysql
oe sudo systemctl status mysql
you can play with sed command to make a replacement in file, something like
sed -i "s/DocumentRoot.*/DocumentRoot <your new path>" <path to httpd/apache2.conf>
PS:
-i makes a backup of your file
DocumentRoot.* will replace all line starting with DocumentRoot (dont remember by heart if there are multiple lines starting with DocumentRoot; in this case, make the correct pattern and not wildcard)
if you have / in your new path, make sure to use \/
The other option (probably a bit more simple) is to push a new conf file under the /etc/apache2/conf-enabled/ directory with your specific setting, in case you have other settings such as VirtualHost or other it will make it more simple

error apache2.service" and "journalctl -xe"

Last time I try add new domain on localhost and I leave it on few weeks so now I try run my apache this command /etc/init.d/apache2 start and I get error
[....] Starting apache2 (via systemctl): apache2.serviceJob for apache2.service failed. See "systemctl status apache2.service" and "journalctl -xe" for details.
failed!
If i tried to do reinstall apache2 but it is still not work.
I just did these two lines.It worked.
Two web servers cannot be active on the one port at the same time
this code for apache & nginx:
or
if error journalctl -xe used this code
sudo apt-get install psmisc
sudo lsof -t -i tcp:80 -s tcp:listen | sudo xargs kill
Virtual Host configuration might cause this error
I solved this same problem by configuring my virtual host .conf files properly.
I created a virtual host & then removed the exapmle.conf file form /etc/apache2/sites-avalable/ but I didn't deleted the examle.conf file from /etc/apache2/sites-enabled/ for this reason i was getting this error.
Then I removed the example.conf file from both the folders( ../sites-enabled & ../sites-available ) and solved this issue.
If you tried to setup any virtual host recently, then try this solution.
Best of Luck
Kill the running process on the port. Hope it will work!
sudo apt-get install psmisc
sudo fuser 80/tcp
sudo lsof -i tcp:80
sudo lsof -i tcp:80 -s tcp:listen
sudo lsof -t -i tcp:80 -s tcp:listen | sudo xargs kill
Go
sudo nano /etc/apache2/apache2.conf
remove this line:
Include /etc/phpmyadmin/apache.conf
Then
service apache2 start/restart
This problem may be a result of some configuration files in apache missing. One of the solutions would be to purge the apache2 file.
You can type:
sudo apt-get purge apache2
Then reinstall apache2 by typing:
sudo apt-get install apache2
As stated in the error message, we just have to execute :
systemctl status apache2.service
or
journalctl -xe
And you will have more detail about the error (line of the error, or command misspelled, or module not included in the configuration, ...) :
for example you can have following detail Invalid command 'SSLEngine', perhaps misspelled or defined by a module not included in the server configuration ==> you then need to execute a2enmod ssl, and then execute service apache2 restart
Also I notice a difference between service apache2 reload and service apache2 restart commands. In case of persisting errors you should execute service apache2 restart, and then execute journalctl -xe.
You type
sudo netstat -pant
You check are you using port 80. If used, `
sudo service 'service_name' stop
and
sudo service apache2 start
The problem is because some configuration files are deleted.
You can use the following command to replace configuration files that have been deleted, without purging the package:
sudo apt-get -o DPkg::Options::="--force-confmiss" --reinstall install apache2
execute sudo service apache2 status and check the result. it might be trying to bind to a port that is already in use