N
N
nikita1sm2019-08-08 11:34:20
linux
nikita1sm, 2019-08-08 11:34:20

Cron Centos 7 why can't run the script?

Please tell me:
- created a script: stop.sh

# ! /bin/sh
systemctl stop mysql
systemctl stop httpd

added it to cron
30 10 * * * /home/stop.sh
but neither via cron nor manually - it doesn't work.
manually run:
./stop.sh
writes errors:
Failed to stop mysql\x0d.service: Unit mysql\x0d.service not loaded.
Failed to stop httpd\x0d.service: Unit httpd\x0d.service not loaded.

Answer the question

In order to leave comments, you need to log in

3 answer(s)
V
Vitsliputsli, 2019-08-09
@nikita1sm

Adjust line breaks to match the system on which you are using this file.
And don't create files on Windows.

D
Denis, 2019-08-08
@WolFman

Try like this, service mysql stop
service httpd stop
30 10 * * * /bin/sh /home/stop.sh

A
Anatoly Denisov, 2019-08-08
@Wildcorsa

So in Centos, the service is called mariadb, not mysql

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question