[root@localhost system]# vi apache.service
[Unit]
Description=apache
After=network.target
[Service]
Type=forking
ExecStart=/usr/local/apache/bin/apachectl start
ExecReload=/usr/local/apache/bin/apachectl restart
ExecStop=/usr/local/apache/bin/apachectl stop
PrivateTmp=true
[Install]
WantedBy=multi-user.target
===================
上面是一个apache http服务器的自启动服务文件,如果把PrivateTmp的值设置成true ,服务启动时会在/tmp目录下生成类似systemd-private-433ef27ba3d46d8aac286aeb
但有时候这相反而不方便,如:启动mysql服务,/tmp/mysql.sock文件的存放就会放到私有文件夹中,这时需要将PrivateTmp的值设置成false:PrivateTmp=false。