約 4,161,759 件
https://w.atwiki.jp/linux2ch/pages/25.html
Linux Inside Linux をプレインストールしたクライアント・コンピューターを紹介します。 Linux Inside プレインストール・パソコンについて メーカー・サポート情報 デル エプソン・ダイレクト リナックスマニア エムワイコムテック 関連記事 2ch 関連スレッド プレインストール・パソコンについて あらかじめOSやアプリケーションをハードディスクに組み込んで製品として販売されているコンピューターのこと。 Linux をプレインストールしたパソコンを参考までに紹介。Linux を新規インストールする作業が省けます。ただし、紹介した製品に関して動作保証・動作確認しているわけではありません。 メーカー・サポート情報 メーカーではプレインストール機種を発売していない場合でも Linux の動作関連情報を公開していることがあるので、参考に。 ハードウェア対応情報 デル mini9 @ ウィキ (Inspiron mini 9 についてのまとめ wiki) http //www19.atwiki.jp/mini9/ 【レビュー】格安Ubuntu搭載モデルも用意 - デル「Inspiron Mini 10v」 http //journal.mycom.co.jp/articles/2009/07/28/inspiron_mini_10v/ むきました:デルが放つ低価格スリムノート「Inspiron Mini 12」の中味を拝見した http //plusd.itmedia.co.jp/pcuser/articles/0902/04/news042.html エプソン・ダイレクト http //shop.epson.jp/pc/lx9000/ リナックスマニア http //www.linuxmania.jp/ エムワイコムテック http //www.mycomtec.biz/ 関連記事 ネットブックでLinux(第56回)塩田紳二「モバイルトレンド」 http //pc.nikkeibp.co.jp/article/column/20090121/1011520/ 2ch 関連スレッド Linux板 【ASUS】Eee PC Linux版の国内販売を待つスレ http //pc11.2ch.net/test/read.cgi/linux/1201495155/ ノーパソ DELL Inspiron Mini 9 発売 http //pc11.2ch.net/test/read.cgi/linux/1221507147/ ノートPC板 「技術情報3」EeePCでLINUX http //pc11.2ch.net/test/read.cgi/notepc/1233299324/ 「技術情報2」EeePCでLINUX http //pc11.2ch.net/test/read.cgi/notepc/1216179256/ 【技術情報】NetbookでLinux【Aspireone】 http //pc11.2ch.net/test/read.cgi/notepc/1234549476/
https://w.atwiki.jp/ohden/pages/129.html
特定のディレクトリを任意の仮想ドライブとする。 substコマンドを使う方法とレジストリを使う方法と2種類あるらしい。 注意したいのは、substの方法では実行したユーザでしか使えないってこと。 つまり、管理者権限で実行したアプリケーションから、substで作成したドライブへのアクセスはできないんです。 正確に言うと、Admin昇格後にsubstコマンドを実行した後、アプリケーションからアクセスしなければならない。 最初っから誰からでもアクセスできるドライブにしたかったらレジストリを使った方法を利用した方が良い。 substを使う方法 subst 【ドライブ名】 【ディレクトリパス】 e.g.) c cd \mkdir ddrivesubst d c \ddrive カレントドライブをCに変更root dirへ移動drive dirを作成仮想ドライブの作成 ※2回目以降は仮想ドライブの作成だけでOK 作成した仮想ドライブの削除は、ドライブを指定し『/d』オプションを指定して実行。 subst d /d 仮想ドライブの削除。上で作成したDドライブを削除する。 ただし、作成対象のドライブ名が既に使われてると、 無効なパラメータです - D とか表示されます。(ノ∀`) ど~してもそのdrive名を使いたかったら『マイコンピュータ』を右クリックして『管理』を押下。 下の方にある『ディスクの管理』ってトコclickして、右に出てきたdisk一覧からdrive名を変更したいdiskを右クリックして、『ドライブ文字とパスの変更』ってトコからdrive名を変える事ができます。(*´ω`)b この方法でdrive名空けてからコマンドを再実行したってください。 あと、この方法で作った仮想ドライブへは全ユーザ対象としてapplicationをinstallすることはできないっぽぃ。 レジストリを使う方法 上記のsubstと同様の効果をレジストリを使って実現する。 レジストリを使う方法なら、権限によるアクセスできない問題も回避可能。 subst d c \ddrive と同様の効果を得るには、レジストリエディタを起動して... regedit 『HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Control\Session Manager\DOS Devices』を見つける。 上記のキーを右クリックして[新規]-[文字列値]を選択。 名前に『【ドライブ名】 』と入力。 入力後、その値をダブルクリック。文字列の編集ダイアログが開くので『値のデータ』に『\??\【ディレクトリパス】』を設定する。 unmountしたい場合は、上記で追加した文字列値を削除するだけ。 で、レジストリを使う方法では、実際にmountさせたりunmountさせたりを動的にできない。 起動時に読み込まれて勝手に追加されるので、レジストリキーを修正後、OS再起動が必要になる。 追記 2016-05-17 VMとかの仮想光学driveと重複するように設定すると、見た目は光学drive、中身は仮想ドライブで指定したフォルダという謎な状況になる。コナン君みたいじゃね。 そんときは、一旦registryに設定したドライブ文字を変更して、光学driveの文字を変更後、再度registryの設定をすれば良い。 更新日: 2022年09月16日 (金) 10時41分58秒
https://w.atwiki.jp/hobata/pages/16.html
tagファイル作成 #!/bin/sh # make tags file / for vi operation jump CTRL+] , return CTRL+T # mktags.sh # find `pwd` -type f -name "*.[ch]" -o -name "*.[sS]" | sed -e s/^/"/ -e s/$/"/ | xargs /usr/bin/ctags -a キーワード検索 #!/bin/sh find -name "*.[csh]" -type f | xargs grep -n key_word /dev/null | less カレントに展開 # 今どきのtarは、圧縮形式を自動判別してくれる。便利 tar xf /sora/hoge.tar.bz2 漢字コード変換 #!/bin/sh # kconv.sh folder_name # rm -rf $1_bak cp -rp $1 $1_bak for f in `find $1 -type f -iname "*[che]" ` do cp $f $f-1 iconv -f UTF-8 $f-1 -t EUC-JP $f rm $f-1 done i-node番号や総数を確認 例1:ls -i 例2:df -i -
https://w.atwiki.jp/parepan/pages/238.html
ディレクトリの準備 # mkdir /usr/local/flex3 # cd /usr/local/flex3 Flex3-SDKを入手 # wget http //download.macromedia.com/pub/flex/sdk/flex_sdk_3.zip 解凍 # unzip flex_sdk_3.zip profileの設定 # vi ~/.bash_profile --------------- 以下の二行を追加 ---------------------- export FLEX_HOME=/usr/local/flex3 export PATH=$PATH $FLEX_HOME/bin $FLEX_HOME/player/debug --------------- ここまで ---------------------- profile反映 # source ~/.bash_profile パスが通っているかの確認 # which mxmlc 以下のように表示されればOK /usr/local/flex3/bin/mxmlc コンパイル方法 # mxmlc HelloWorld.mxml Over!
https://w.atwiki.jp/rinn/pages/11.html
Linux デバッグ方法 Linuxで、Solaris のtrussにあたるコマンドが、straceになります。 このコマンドからコマンド実行すると実行されたコマンドで実施したシステムファンクションコール などの情報が得られます。 strace -f -F -o /tmp/log.txt コマンド 例) /usr/bin/strace -f z-F -o /tmp/log.txt java 出力例) [pid 2756] gettimeofday( unfinished ... [pid 2762] ... mmap2 resumed ) = 0xaa90e000 [pid 2756] ... gettimeofday resumed {1157439854, 233864}, NULL) = 0 [pid 2756] gettimeofday( unfinished ... [pid 2762] sigaltstack(NULL unfinished ... [pid 2756] ... gettimeofday resumed {1157439854, 234344}, NULL) = 0 [pid 2762] ... sigaltstack resumed , {ss_sp=0xaa904000, ss_flags=0, ss_size=40960}) = 0
https://w.atwiki.jp/aerocats/pages/37.html
標準Linuxの/usr/local/bin/内にある。 スクリプト ~ # cat /usr/local/bin/KeventHandller.sh #!/bin/sh # $1 Kernel event name . /usr/local/bin/kuro_lib case $1 in lanact) if [ "$3" = "full" ] ; then FULL_HALF="f" else FULL_HALF="h" fi case $2 in 0) LINKSPEED="nolink" ;; 10) LINKSPEED="10${FULL_HALF}" ;; 100) LINKSPEED="100${FULL_HALF}" ;; 1000) LINKSPEED="1000" ;; *) ;; esac . /etc/netinfo [ ! -f /var/lock/networking ] [ "${my_ipaddress}" = "dhcp" ] \ [ $2 -ne 0 ] [ -f /var/tmp/bootcomplete ] \ /etc/init.d/networking.sh restart ;; micon_interrupts) INT_DETAIL=`$MICONAPL -a int_get_switch_status |grep "int=" |sed -e "s/int=//"` case ${INT_DETAIL} in power_sw) /usr/local/bin/shutdown.sh normal ;; init_sw_front) /usr/local/bin/InitDisk1.sh ;; *) ;; esac MiconIntEnable ;; *) echo "Unknown(or not supported) event driven." ;; esac ~ #
https://w.atwiki.jp/gleaning/pages/17.html
Firefoxによるウェブページの表示 Linuxで使えるウェブブラウザは数多存在するけど、なんだかんだいって、事実上のスタンダードはMozilla Firefoxといって間違いないと思われる。 コマンドラインからfirefoxを操作することは滅多にないことだが、Emacsやおちゅ〜しゃからブラウザを起動したい場合に、コマンドラインからの操作方法を知っておく必要がある。 firefoxの単純な起動 firefox URLを指定して起動 例 firefox http //www10.atwiki.jp/gleaning/ 現在起動している firefox を使って指定URLを表示 例 firefox -a firefox -remote "openURL(http //www10.atwiki.jp/gleaning/)" 現在起動している firefox に新しいタブを追加して表示 例 firefox -a firefox -remote "openURL(http //www10.atwiki.jp/gleaning/,new-tab)" たとえば、おちゅ〜しゃで外部ウェブブラウザを起動するコマンドは下記のようにする。 firefox -a firefox -remote "openURL(%s,new-tab)" ブックマークレット(bookmarklet) Firefoxに限った話ではないが、bookmarkletを使うことによって、ちょっとした調べものなどの手間が省けて便利になったりする。Firefoxの場合はブックマークツールバーフォルダに bookmarklet を登録しておき、ブックマークツールバーを表示するようにしておけば、簡単にブックマークにアクセスできるようになるので、ここに bookmarklet を登録しておけば便利になる。 英辞郎 下記を一行にまとめてブックマークに登録する。単語を選択してからこのbookmarkletを選択すれば簡単に単語の意味を調べることができる(日英、英日とも)。 javascript var d=document; var w=d.selection?d.selection.createRange().text d.getSelection(); location.href= http //www2.alc.co.jp/ejr/index.php?word_in= +w+ word_in2=dummy word_in3=dummy ;
https://w.atwiki.jp/lookworld/pages/59.html
■ホスト名称の確認 /etc/hosts 例)192.xx.xx.1 hhh.xxx.co.jp hhh 127.0.0.1 localhost.localdomain localhost ■ネットワーク設定の確認 /etc/sysconfig/network 例)NETWORKING=yes HOSTNAME=hhh ■IPアドレスの確認 /etc/sysconfig/network-scripts/ifcfg-eth0 例)DEVICE=eth0← ネットワーク・インタフェース名 BOOTPROTO=none← 固定IPアドレスの場合の指定 手動でIPアドレスを指定する時は、"static" BROADCAST=10.20.xx.255← ブロードキャスト・アドレス HWADDR=00 01 02 xx xx C8← MACアドレス IPADDR=10.20.xx.xx← IPアドレス NETMASK=255.255.255.0← ネット・マスク NETWORK=10.20.xx.0← ネットワーク・アドレス ONBOOT=yes← マシン起動時にネットワークを有効にする場合はyes TYPE=Ethernet GATEWAY=10.20.xx.254← ゲットウェイ USERCTL=no IPV6INIT=no PEERDNS=yes ■DNSサーバのIPアドレスをの確認 /etc/resolv.conf domain xxx.xxx.co.jp ■telnetを有効にする /etc/xinetd.d/krb5-telnet # default off # description The kerberized telnet server accepts normal telnet sessions, \ # but can also use Kerberos 5 authentication. service telnet { flags = REUSE socket_type = stream wait = no user = root server = /usr/kerberos/sbin/telnetd log_on_failure += USERID disable = yes← 初期値としては、"yes" } disable = yes を no に変更 変更したxinetdの設定ファイルを反映させるため、再起動 $ su - ・・・ root権限で接続 # /etc/rc.d/init.d/xinetd restart ■FTPの自動起動を有効にする # /sbin/chkconfig vsftpd on ■FTPの設定 vi /etc/vsftpd/vsftpd.conf anonymous_enable=NO ←YES を NO に変更→ Anonymousユーザ(匿名ユーザ)によるアクセスを許可するかの指定。 ascii_upload_enable=YES ←# を削除→ Asciiモードによる、アップロード/ダウンロードを許可するかを指定。 ascii_download_enable=YES ←# を削除→ Asciiモードによる、アップロード/ダウンロードを許可するかを指定。 : userlist_deny=NO ←追加→ /etc/vsftpd.user_list にて指定されたユーザのアクセスを許可するかを指定。 use_localtime=YES ←追加→ 日本標準時間を使うかどうかを指定。デフォルトはGMTによる表示。 vi /etc/vsftpd.user_list 特定ユーザしかFTPを使用できなくするユーザアクセス制限のために、デフォルト値の先頭に # を追記し、すべてコメントアウト #root #bin #daemon #adm #lp #sync #shutdown #halt #mail #news #uucp #operator #games #nobody FTPログインを許可するユーザを追加 ftp_user_name ■FTPの再起動 # /sbin/service vsftpd start ■Sendmailの設定 1./etc/mail/sendmail.mc を編集する 以下のファイルを編集する。 ※編集する前にsendmail.mcとsendmail.cfのオリジナルをコピーしておくことをお勧めします。 [root@Ee-Cash ~]# cp -p /etc/mail/sendmail.mc /etc/mail/sendmail.mc.org [root@Ee-Cash ~]# vi /etc/mail/sendmail.mc ①22行目あたりに、下記のような「SMART_HOST」という記述があると思うので、これを変更します。 (変更前)dnl define(`SMART_HOST ,`smtp.your.provider ) ↓ (変更後) define(`SMART_HOST ,`smtp [10.20.XX.XX] )dnl ②100行目あたりに、下記のような「EXPOSED_USER」という記述があると思うので、これの下に下記を追加します。 (変更前)EXPOSED_USER(`root )dnl ↓ (変更後)EXPOSED_USER(`root )dnl FEATURE(`nocanonify )dnl ③105行目あたりに、下記のような「DAEMON_OPTIONS(`Port=smtp)」という記述があると思うので、これをコメント(dnlを挿入)します。 (変更前)DAEMON_OPTIONS(`Port=smtp,Addr=127.0.0.1, Name=MTA )dnl ↓ (変更後)dnl DAEMON_OPTIONS(`Port=smtp,Addr=127.0.0.1, Name=MTA )dnl ================================================================================ $ more sendmail.mc divert(-1)dnl dnl # dnl # This is the sendmail macro config file for m4. If you make changes to dnl # /etc/mail/sendmail.mc, you will need to regenerate the dnl # /etc/mail/sendmail.cf file by confirming that the sendmail-cf package is dnl # installed and then performing a dnl # dnl # make -C /etc/mail dnl # include(`/usr/share/sendmail-cf/m4/cf.m4 )dnl VERSIONID(`setup for Red Hat Linux )dnl OSTYPE(`linux )dnl dnl # dnl # default logging level is 9, you might want to set it higher to dnl # debug the configuration dnl # dnl define(`confLOG_LEVEL , `9 )dnl dnl # dnl # Uncomment and edit the following line if your outgoing mail needs to dnl # be sent out through an external mail server dnl # dnl define(`SMART_HOST ,`smtp.your.provider ) define(`SMART_HOST ,`smtp [10.20.88.1] )dnl dnl # define(`confDEF_USER_ID ,``8 12 )dnl dnl define(`confAUTO_REBUILD )dnl define(`confTO_CONNECT , `1m )dnl define(`confTRY_NULL_MX_LIST ,true)dnl define(`confDONT_PROBE_INTERFACES ,true)dnl define(`PROCMAIL_MAILER_PATH ,`/usr/bin/procmail )dnl define(`ALIAS_FILE , `/etc/aliases )dnl define(`STATUS_FILE , `/var/log/mail/statistics )dnl define(`UUCP_MAILER_MAX , `2000000 )dnl define(`confUSERDB_SPEC , `/etc/mail/userdb.db )dnl define(`confPRIVACY_FLAGS , `authwarnings,novrfy,noexpn,restrictqrun )dnl define(`confAUTH_OPTIONS , `A )dnl dnl # dnl # The following allows relaying if the user authenticates, and disallows dnl # plaintext authentication (PLAIN/LOGIN) on non-TLS links dnl # dnl define(`confAUTH_OPTIONS , `A p )dnl dnl # dnl # PLAIN is the preferred plaintext authentication method and used by dnl # Mozilla Mail and Evolution, though Outlook Express and other MUAs do dnl # use LOGIN. Other mechanisms should be used if the connection is not dnl # guaranteed secure. dnl # Please remember that saslauthd needs to be running for AUTH. dnl # dnl TRUST_AUTH_MECH(`EXTERNAL DIGEST-MD5 CRAM-MD5 LOGIN PLAIN )dnl dnl define(`confAUTH_MECHANISMS , `EXTERNAL GSSAPI DIGEST-MD5 CRAM-MD5 LOGIN PLAIN )dnl dnl # dnl # Rudimentary information on creating certificates for sendmail TLS dnl # cd /usr/share/ssl/certs; make sendmail.pem dnl # Complete usage dnl # make -C /usr/share/ssl/certs usage dnl # dnl define(`confCACERT_PATH ,`/usr/share/ssl/certs ) dnl define(`confCACERT ,`/usr/share/ssl/certs/ca-bundle.crt ) dnl define(`confSERVER_CERT ,`/usr/share/ssl/certs/sendmail.pem ) dnl define(`confSERVER_KEY ,`/usr/share/ssl/certs/sendmail.pem ) dnl # dnl # This allows sendmail to use a keyfile that is shared with OpenLDAP s dnl # slapd, which requires the file to be readble by group ldap dnl # dnl define(`confDONT_BLAME_SENDMAIL ,`groupreadablekeyfile )dnl dnl # dnl define(`confTO_QUEUEWARN , `4h )dnl dnl define(`confTO_QUEUERETURN , `5d )dnl dnl define(`confQUEUE_LA , `12 )dnl dnl define(`confREFUSE_LA , `18 )dnl define(`confTO_IDENT , `0 )dnl dnl FEATURE(delay_checks)dnl FEATURE(`no_default_msa ,`dnl )dnl FEATURE(`smrsh ,`/usr/sbin/smrsh )dnl FEATURE(`mailertable ,`hash -o /etc/mail/mailertable.db )dnl FEATURE(`virtusertable ,`hash -o /etc/mail/virtusertable.db )dnl FEATURE(redirect)dnl FEATURE(always_add_domain)dnl FEATURE(use_cw_file)dnl FEATURE(use_ct_file)dnl dnl # dnl # The following limits the number of processes sendmail can fork to accept dnl # incoming messages or process its message queues to 12.) sendmail refuses dnl # to accept connections once it has reached its quota of child processes. dnl # dnl define(`confMAX_DAEMON_CHILDREN , 12)dnl dnl # dnl # Limits the number of new connections per second. This caps the overhead dnl # incurred due to forking new sendmail processes. May be useful against dnl # DoS attacks or barrages of spam. (As mentioned below, a per-IP address dnl # limit would be useful but is not available as an option at this writing.) dnl # dnl define(`confCONNECTION_RATE_THROTTLE , 3)dnl dnl # dnl # The -t option will retry delivery if e.g. the user runs over his quota. dnl # FEATURE(local_procmail,` ,`procmail -t -Y -a $h -d $u )dnl FEATURE(`access_db ,`hash -T -o /etc/mail/access.db )dnl FEATURE(`blacklist_recipients )dnl EXPOSED_USER(`root )dnl FEATURE(`nocanonify )dnl dnl # dnl # The following causes sendmail to only listen on the IPv4 loopback address dnl # 127.0.0.1 and not on any other network devices. Remove the loopback dnl # address restriction to accept email from the internet or intranet. dnl # dnl DAEMON_OPTIONS(`Port=smtp,Addr=127.0.0.1, Name=MTA )dnl dnl # dnl # The following causes sendmail to additionally listen to port 587 for dnl # mail from MUAs that authenticate. Roaming users who can t reach their dnl # preferred sendmail daemon due to port 25 being blocked or redirected find dnl # this useful. dnl # dnl DAEMON_OPTIONS(`Port=submission, Name=MSA, M=Ea )dnl dnl # dnl # The following causes sendmail to additionally listen to port 465, but dnl # starting immediately in TLS mode upon connecting. Port 25 or 587 followed dnl # by STARTTLS is preferred, but roaming clients using Outlook Express can t dnl # do STARTTLS on ports other than 25. Mozilla Mail can ONLY use STARTTLS dnl # and doesn t support the deprecated smtps; Evolution 1.1.1 uses smtps dnl # when SSL is enabled-- STARTTLS support is available in version 1.1.1. dnl # dnl # For this to work your OpenSSL certificates must be configured. dnl # dnl DAEMON_OPTIONS(`Port=smtps, Name=TLSMTA, M=s )dnl dnl # dnl # The following causes sendmail to additionally listen on the IPv6 loopback dnl # device. Remove the loopback address restriction listen to the network. dnl # dnl DAEMON_OPTIONS(`port=smtp,Addr= 1, Name=MTA-v6, Family=inet6 )dnl dnl # dnl # enable both ipv6 and ipv4 in sendmail dnl # dnl DAEMON_OPTIONS(`Name=MTA-v4, Family=inet, Name=MTA-v6, Family=inet6 ) dnl # dnl # We strongly recommend not accepting unresolvable domains if you want to dnl # protect yourself from spam. However, the laptop and users on computers dnl # that do not have 24x7 DNS do need this. dnl # FEATURE(`accept_unresolvable_domains )dnl dnl # dnl FEATURE(`relay_based_on_MX )dnl dnl # dnl # Also accept email sent to "localhost.localdomain" as local email. dnl # LOCAL_DOMAIN(`localhost.localdomain )dnl dnl # dnl # The following example makes mail from this host and any additional dnl # specified domains appear to be sent from mydomain.com dnl # dnl MASQUERADE_AS(`mydomain.com )dnl dnl # dnl # masquerade not just the headers, but the envelope as well dnl # dnl FEATURE(masquerade_envelope)dnl dnl # dnl # masquerade not just @mydomainalias.com, but @*.mydomainalias.com as well dnl # dnl FEATURE(masquerade_entire_domain)dnl dnl # dnl MASQUERADE_DOMAIN(localhost)dnl dnl MASQUERADE_DOMAIN(localhost.localdomain)dnl dnl MASQUERADE_DOMAIN(mydomainalias.com)dnl dnl MASQUERADE_DOMAIN(mydomain.lan)dnl MAILER(smtp)dnl MAILER(procmail)dnl ================================================================================ 2./etc/mail/sendmail.cf を作成する # m4 /etc/mail/sendmail.mc /etc/mail/sendmail.cf 3./etc/mail/submit.mc を編集する 以下のファイルを編集する。 ※編集する前にsubmit.mcとsubmit.cfのオリジナルをコピーしておくことをお勧めします。 [root@Ee-Cash ~]# cp -p /etc/mail/submit.mc /etc/mail/submit.mc.org [root@Ee-Cash ~]# vi /etc/mail/submit.mc ①25行目あたりに、下記のような「confDIRECT」という記述があると思うので、これを変更します。 (変更前)dnl define(`confDIRECT_SUBMISSION_MODIFIERS ,`C ) ↓ (変更後) define(`confDIRECT_SUBMISSION_MODIFIERS ,`C ) 4./etc/mail/submit.cf を作成する m4コマンドでsubmit.cfを更新する。 [root@Ee-Cash ~]# m4 /etc/mail/submit.mc /etc/mail/submit.cf 5./etc/Hosts ファイル に上記で設定したSMTPサーバー(メールサーバー)を登録する # vi /etc/hosts 例)10.20.xx.xx xx.xx.co.jp hhh 127.0.0.1 localhost.localdomain localhost 6.設定値を反映させるため、SendMailを再起動する # /etc/init.d/sendmail restart
https://w.atwiki.jp/kotya/pages/4.html
設定ファイル Tips CentOS Tools Links 開発環境
https://w.atwiki.jp/suffix/pages/1469.html
ここではServiceの書き方について、まとめる。 Serviceは大きく、[Unit][Service][Install]のセクションに分かれる。 設定したUnitの詳細情報を確認する場合は、systemctl show Unit名とすると良い。 [Unit] 依存関係を規定 Description Unitの説明文 Requires 同時に有効化が必要なUnit Wants 同時に有効化が必要なUnit Before 自分自身は本項目で設定したUnitの前に起動 After 自分自身は本項目で設定したUnitの後に起動 ※Unit一覧はsystemctl list-unit-filesで確認可能。 ※Unitのタイプ(target,service,mountなど)についてはこちらのサイト参照。 [Service] BusName サービスが到達可能なbus接続名 EnvironmentFile 環境変数を読み込むファイル ExecReload サービスリロード時の実行コマンド ExecStartPre サービス起動前のコマンド ExecStartPost サービス起動後のコマンド ExecStart サービス起動時の実行コマンド ExecStop サービス停止時の実行コマンド ExecStopPost サービス停止後のコマンド KillMode ExecStopで停止せずに残ったプロセスの処理方法 LimitCORE Coreファイル(プロセス異常終了時のメモリ内容)に関する設定 LimitNOFILE サービスが開けるファイル数の上限。 LimitNPROC サービスのプロセス/スレッドの上限数 PIDFile メインプロセスのPIDファイル出力先 Restart サービスプロセス停止時の再起動条件。always,no,on-success,on-failure等がある。 RestartSec サービス再起動までのスリープ時間 StartLimitInterval 再起動を試みるまでのインターバル期間 SuccessExitStatus メインプロセスに返却される正常終了時のexit status TimeoutStartSec 起動完了までに待機する時間 TimeoutStopSec 停止完了するまでに待機する時間 Type サービスプロセスの起動タイプ。(simple バックグラウンド実行,forking 最初のプロセスは停止し、子プロセスをバックグランド実行,oneshot 単発実行,notify:sd_notifyを使用,dbus dbusを使用がある) User/Group プロセスを起動するユーザ/グループ [Install] enable/disableに関する内容を記載 WantedBy enable時にこのUnitの.wantsディレクトリにシンボリックリンクをはる RequiredBy enable時にこのUnitの.requiredディレクトリにシンボリックリンクをはる Also enable/disable時に同時にenable/disableするUnit ■参考: https //www.slideshare.net/enakai/linux-27872553 https //www.freedesktop.org/software/systemd/man/systemd.service https //www.ume-ch.net/archives/17