{"id":267,"date":"2012-04-18T03:13:26","date_gmt":"2012-04-18T01:13:26","guid":{"rendered":"http:\/\/xn--jrme-bpa1e.net\/blog\/?p=267"},"modified":"2013-08-01T18:39:06","modified_gmt":"2013-08-01T16:39:06","slug":"script-rc-d-pour-demarrer-minecraft","status":"publish","type":"post","link":"https:\/\/xn--jrme-bpa1e.net\/blog\/post\/267\/script-rc-d-pour-demarrer-minecraft\/","title":{"rendered":"Script rc.d pour d\u00e9marrer minecraft"},"content":{"rendered":"<p><code><br \/>\n#!\/bin\/sh<br \/>\n#<br \/>\n# PROVIDE: minecraft<br \/>\n# REQUIRE: LOGIN DAEMON NETWORKING mountcritlocal<br \/>\n# KEYWORD: shutdown<br \/>\n#<br \/>\n# Add the following lines to \/etc\/rc.conf.local to enable the minecraft server:<br \/>\n#<br \/>\n# minecraft_enable=\"YES\"<br \/>\n#<br \/>\n# For default setup, create a user named 'minecraft', set its home directory<br \/>\n# to \/srv\/minecraft, and place minecraft_server.jar into \/srv\/minecraft<br \/>\n#<br \/>\n# See minecraft_server.jar for flags<\/p>\n<p>. \/etc\/rc.subr<\/p>\n<p>name=minecraft<br \/>\nrcvar=`set_rcvar`<\/p>\n<p>load_rc_config ${name}<\/p>\n<p>command=\/usr\/local\/bin\/screen<br \/>\npidfile=\/var\/run\/minecraft.pid<\/p>\n<p>start_cmd=\"${name}_start\"<br \/>\nstop_cmd=\"${name}_stop\"<br \/>\nstatus_cmd=\"${name}_status\"<\/p>\n<p>: ${minecraft_screen_session=\"minecraft-session\"}<br \/>\n: ${minecraft_user=\"minecraft\"}<br \/>\n: ${minecraft_flags=\"\"}<br \/>\n: ${minecraft_args=\"\/home\/minecraft\/start\"}<\/p>\n<p>minecraft_start() {<br \/>\n    unset \"${rc_arg}_cmd\"<br \/>\n    minecraft_flags=\"-d -m -S ${minecraft_screen_session} ${minecraft_args}\"<br \/>\n    if minecraft_running; then<br \/>\n        echo \"minecraft already running?\"<br \/>\n    else<br \/>\n        run_rc_command \"start\"<br \/>\n    fi<br \/>\n}<\/p>\n<p>minecraft_stop() {<br \/>\n    local cmd<br \/>\n    cmd=\"${command} -p 0 -S ${minecraft_screen_session} -X eval 'stuff stop\\015'\"<br \/>\n    if minecraft_running; then<br \/>\n        echo \"Stopping minecraft.\"<br \/>\n        su -m ${minecraft_user} -c \"${cmd}\"<br \/>\n    fi<br \/>\n}<\/p>\n<p>minecraft_status() {<br \/>\n    if minecraft_running; then<br \/>\n        echo \"minecraft is running.\"<br \/>\n        return 0<br \/>\n    else<br \/>\n        echo \"minecraft is not running.\"<br \/>\n        return 1<br \/>\n    fi<br \/>\n}<\/p>\n<p>minecraft_running() {<br \/>\n    local check ses<br \/>\n    ses=\"${minecraft_screen_session}\"<br \/>\n    check=`su -m ${minecraft_user} -c \"${command} -list\" | grep ${ses}`<br \/>\n    if [ \"$check\" ]; then<br \/>\n        return 0<br \/>\n    else<br \/>\n        return 1<br \/>\n    fi<br \/>\n}<\/p>\n<p>run_rc_command \"$1\"<br \/>\n<\/code><\/p>\n","protected":false},"excerpt":{"rendered":"<p>#!\/bin\/sh # # PROVIDE: minecraft # REQUIRE: LOGIN DAEMON NETWORKING mountcritlocal # KEYWORD: shutdown # # Add the following lines to \/etc\/rc.conf.local to enable the minecraft server: # # minecraft_enable=\u00a0\u00bbYES\u00a0\u00bb # # For default setup, create a user named &lsquo;minecraft&rsquo;, &hellip; <a href=\"https:\/\/xn--jrme-bpa1e.net\/blog\/post\/267\/script-rc-d-pour-demarrer-minecraft\/\">Continuer la lecture <span class=\"meta-nav\">&rarr;<\/span><\/a><\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"closed","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[6,4],"tags":[],"class_list":["post-267","post","type-post","status-publish","format-standard","hentry","category-freebsd","category-geek"],"_links":{"self":[{"href":"https:\/\/xn--jrme-bpa1e.net\/blog\/wp-json\/wp\/v2\/posts\/267","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/xn--jrme-bpa1e.net\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/xn--jrme-bpa1e.net\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/xn--jrme-bpa1e.net\/blog\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/xn--jrme-bpa1e.net\/blog\/wp-json\/wp\/v2\/comments?post=267"}],"version-history":[{"count":4,"href":"https:\/\/xn--jrme-bpa1e.net\/blog\/wp-json\/wp\/v2\/posts\/267\/revisions"}],"predecessor-version":[{"id":330,"href":"https:\/\/xn--jrme-bpa1e.net\/blog\/wp-json\/wp\/v2\/posts\/267\/revisions\/330"}],"wp:attachment":[{"href":"https:\/\/xn--jrme-bpa1e.net\/blog\/wp-json\/wp\/v2\/media?parent=267"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/xn--jrme-bpa1e.net\/blog\/wp-json\/wp\/v2\/categories?post=267"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/xn--jrme-bpa1e.net\/blog\/wp-json\/wp\/v2\/tags?post=267"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}