K
K
Kolya Babochkin2016-11-29 14:15:55
linux
Kolya Babochkin, 2016-11-29 14:15:55

How to output systemctl response to terminal?

Worked earlier only with 6.5 version of CentOS. And here you need it on the 7th version of CentOS
As it turned out, the old command
service httpd restart
left, another one came in its place.
systemctl restart httpd.service
But on 6.5, the answer was displayed immediately in the terminal, but in the 7th version - no
Tell the teapot what needs to be done to see if this is after running the command?

Stopping httpd:                                            [  OK  ]
Starting httpd:                                            [  OK  ]

Answer the question

In order to leave comments, you need to log in

8 answer(s)
S
sim3x, 2016-11-29
@ArtemichRulit

Show with what code the previous command ended
0 - OK
1 - ERROR
Show what is happening with the service in general, a piece of logs
systemctl status <servicename>

A
Alistair O, 2016-11-29
@box4

use && or ||
e.g. systemctl restart httpd.service || echo "failed to restart"
or systemctl restart httpd.service && echo "daemon restarted"

E
Erelecano Oioraen, 2016-11-29
@Erelecano

Ho-ho. It also lacks normal output in systemd on restart.
Googled in due time, I didn’t see the output similar to the old Internet anywhere for systemd
. I use systemctl status in order to look at the results. A crutch, but I didn’t find another solution when I was looking, maybe someone will tell us both now, and if not, then do as I do.

D
Dmitry Aitkulov, 2016-11-30
@Scarfase1989

well, usually if the error didn’t fall out, then everything is fine, otherwise systemctl status -l <service_name>. Get used to it, I also got used to it for a long time after 6 centos, then I even liked it

A
Alexey Emelyanov, 2017-09-28
@babarun

journalctl -xe

A
Andrew, 2017-03-21
@ddimonn8080

Try this

<?php
$id = 1;
$arrayName = 'tmpl_' . $id;
global ${$arrayName};

${$arrayName}[] = 'string';

var_dump(${$arrayName});

H
hufawoso, 2017-03-21
@hufawoso

<?php

$id = 1;

$arrayName = 'tmpl_' . $id;

global $$arrayName;

($$arrayName)[] = 'string';

var_dump($$arrayName);

S
Stalker_RED, 2017-03-21
@Stalker_RED

$GLOBALS['tmpl' . $id] = ",..,";
But in general, it's best to avoid using global variables.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question