起動時にいくつかのコマンドを実行して質問してください。

起動時にいくつかのコマンドを実行して質問してください。

いくつかの起動コマンドを設定するためにLinux CentOSでこのファイルに移動するとします。

sudo vi /etc/rc.local

この場合、uwsgiを起動したいとしましょう。

したがって、通常はコマンドラインに次のように入力できます。

[linuxuser@localhost ~]$ systemctl start uwsgi
==== AUTHENTICATING FOR org.freedesktop.systemd1.manage-units ====
Authentication is required to start 'uwsgi.service'.
Multiple identities can be used for authentication:
 1.  admin Support (Administrator)
 2.  linuxuser (linuxuser)
Choose identity to authenticate as (1-2): 2
Password: 

起動時にuwsgiが実行されるように、rc.localファイルにIDとパスワードをどのように入力しますか?

このような?

#!/bin/bash
# THIS FILE IS ADDED FOR COMPATIBILITY PURPOSES
#
# It is highly advisable to create own systemd services or udev rules
# to run scripts during boot instead of using this file.
#
# In contrast to previous versions due to parallel execution during boot
# this script will NOT be run after all other services.
#
# Please note that you must run 'chmod +x /etc/rc.d/rc.local' to ensure
# that this script will be executed during boot.

touch /var/lock/subsys/local
systemctl start uwsgi
2
mypassword1$

これは間違っていると思います..

ベストアンサー1

ルートじゃないから認証が欲しいしたがって、rc.localで起動すると、rootとして実行しているかのように動作します。しかし、これは正しい方法ではありません。 uwsgiはサービスなので、起動時に起動するように設定できます。

sudo systemctl enable uwsgi.service

おすすめ記事