{"id":326,"date":"2025-08-22T11:15:56","date_gmt":"2025-08-22T11:15:56","guid":{"rendered":"https:\/\/blog.chaiyakul.com\/?p=326"},"modified":"2025-08-22T11:15:56","modified_gmt":"2025-08-22T11:15:56","slug":"firefox-close-session-old-autostart-centos9","status":"publish","type":"post","link":"https:\/\/blog.chaiyakul.com\/index.php\/2025\/08\/22\/firefox-close-session-old-autostart-centos9\/","title":{"rendered":"\u0e15\u0e31\u0e49\u0e07\u0e43\u0e2b\u0e49 Firefox \u0e1b\u0e34\u0e14\u0e41\u0e17\u0e47\u0e1a\u0e17\u0e35\u0e48\u0e40\u0e1b\u0e34\u0e14\u0e04\u0e23\u0e31\u0e49\u0e07\u0e17\u0e35\u0e48\u0e41\u0e25\u0e49\u0e27 (session \u0e40\u0e01\u0e48\u0e32) \u0e01\u0e48\u0e2d\u0e19\u0e23\u0e31\u0e19\u0e41\u0e17\u0e47\u0e1a\u0e43\u0e2b\u0e21\u0e48\u0e17\u0e31\u0e49\u0e07\u0e2b\u0e21\u0e14\u0e43\u0e2b\u0e49\u0e23\u0e31\u0e19\u0e2d\u0e31\u0e15\u0e42\u0e19\u0e21\u0e31\u0e15\u0e34\u0e2b\u0e25\u0e31\u0e07 login (Autostart) CentOS9"},"content":{"rendered":"\n<p>\u0e15\u0e49\u0e2d\u0e07\u0e2a\u0e23\u0e49\u0e32\u0e07\u0e44\u0e1f\u0e25\u0e4c <code>.desktop<\/code> \u0e43\u0e19\u0e42\u0e1f\u0e25\u0e40\u0e14\u0e2d\u0e23\u0e4c autostart \u0e02\u0e2d\u0e07 user:<\/p>\n\n\n<div class=\"wp-block-syntaxhighlighter-code \"><pre class=\"brush: plain; title: ; notranslate\" title=\"\">\n~\/.config\/autostart\/firefox_cctv.desktop\n<\/pre><\/div>\n\n\n<p>\u0e42\u0e14\u0e22\u0e43\u0e2b\u0e49 <code>Exec<\/code> \u0e0a\u0e35\u0e49\u0e44\u0e1b\u0e17\u0e35\u0e48\u0e2a\u0e04\u0e23\u0e34\u0e1b\u0e15\u0e4c:<\/p>\n\n\n<div class=\"wp-block-syntaxhighlighter-code \"><pre class=\"brush: plain; title: ; notranslate\" title=\"\">\n&#x5B;Desktop Entry]\nType=Application\nExec=\/home\/mill\/start_firefox_cctv.sh\nHidden=false\nNoDisplay=false\nX-GNOME-Autostart-enabled=true\nName=Firefox CCTV Home88\nComment=Start Firefox with CCTV page (clear old tabs first)\n<\/pre><\/div>\n\n\n<p>\u0e01\u0e23\u0e13\u0e35\u0e2d\u0e22\u0e32\u0e01\u0e43\u0e0a\u0e49\u0e44\u0e14\u0e49\u0e17\u0e38\u0e01 user<\/p>\n\n\n\n<p>\u0e27\u0e32\u0e07\u0e2a\u0e04\u0e23\u0e34\u0e1b\u0e15\u0e4c\u0e44\u0e27\u0e49\u0e17\u0e35\u0e48 <code>\/usr\/local\/bin\/<\/code> (\u0e40\u0e2b\u0e21\u0e32\u0e30\u0e01\u0e31\u0e1a\u0e44\u0e1f\u0e25\u0e4c custom script \u0e17\u0e35\u0e48\u0e15\u0e49\u0e2d\u0e07\u0e43\u0e0a\u0e49 system-wide):<\/p>\n\n\n<div class=\"wp-block-syntaxhighlighter-code \"><pre class=\"brush: plain; title: ; notranslate\" title=\"\">\n\/usr\/local\/bin\/start_firefox_cctv.sh\n<\/pre><\/div>\n\n\n<p>\u0e41\u0e25\u0e49\u0e27\u0e17\u0e33\u0e43\u0e2b\u0e49\u0e23\u0e31\u0e19\u0e44\u0e14\u0e49:<\/p>\n\n\n<div class=\"wp-block-syntaxhighlighter-code \"><pre class=\"brush: plain; title: ; notranslate\" title=\"\">\nsudo chmod +x \/usr\/local\/bin\/start_firefox_cctv.sh\n<\/pre><\/div>\n\n\n<p>\u0e08\u0e32\u0e01\u0e19\u0e31\u0e49\u0e19\u0e17\u0e38\u0e01 user \u0e08\u0e30\u0e2a\u0e32\u0e21\u0e32\u0e23\u0e16\u0e1e\u0e34\u0e21\u0e1e\u0e4c:<\/p>\n\n\n<div class=\"wp-block-syntaxhighlighter-code \"><pre class=\"brush: plain; title: ; notranslate\" title=\"\">\nstart_firefox_cctv.sh\n<\/pre><\/div>\n\n\n<p>\u0e44\u0e14\u0e49\u0e40\u0e25\u0e22 (\u0e40\u0e1e\u0e23\u0e32\u0e30 <code>\/usr\/local\/bin<\/code> \u0e2d\u0e22\u0e39\u0e48\u0e43\u0e19 <code>$PATH<\/code> \u0e41\u0e25\u0e49\u0e27)<\/p>\n\n\n\n<p>\u0e42\u0e04\u0e49\u0e14\u0e43\u0e19 start_firefox_cctv.sh<\/p>\n\n\n<div class=\"wp-block-syntaxhighlighter-code \"><pre class=\"brush: plain; title: ; notranslate\" title=\"\">\n#!\/bin\/bash\n\n# ====== \u0e2b\u0e32\u0e42\u0e1f\u0e25\u0e40\u0e14\u0e2d\u0e23\u0e4c\u0e42\u0e1b\u0e23\u0e44\u0e1f\u0e25\u0e4c Firefox ======\nPROFILE_DIR=$(grep -E &#039;^Path=&#039; ~\/.mozilla\/firefox\/profiles.ini | head -n 1 | cut -d= -f2)\n\n# ====== \u0e25\u0e1a\u0e44\u0e1f\u0e25\u0e4c session \u0e40\u0e01\u0e48\u0e32 ======\nrm -f ~\/.mozilla\/firefox\/$PROFILE_DIR\/sessionstore.jsonlz4\nrm -f ~\/.mozilla\/firefox\/$PROFILE_DIR\/sessionCheckpoints.json\nrm -f ~\/.mozilla\/firefox\/$PROFILE_DIR\/recovery.jsonlz4\nrm -f ~\/.mozilla\/firefox\/$PROFILE_DIR\/recovery.baklz4\n\n# ====== \u0e40\u0e1b\u0e34\u0e14 Firefox \u0e41\u0e1a\u0e1a\u0e44\u0e21\u0e48\u0e43\u0e0a\u0e49 session \u0e40\u0e14\u0e34\u0e21 ======\nnohup firefox --new-instance --no-remote \\\n    http:\/\/test.com\/1.html \\\n    http:\/\/test.com\/2.html \\\n    http:\/\/test.com\/3.html \\\n    &gt;\/dev\/null 2&gt;&amp;amp;1 &amp;amp;\n<\/pre><\/div>\n\n\n<p>\u0e2d\u0e18\u0e34\u0e1a\u0e32\u0e22\u0e42\u0e04\u0e49\u0e14\u0e2a\u0e04\u0e23\u0e34\u0e1b\u0e15\u0e4c\u0e19\u0e35\u0e49\u0e17\u0e35\u0e25\u0e30\u0e1a\u0e23\u0e23\u0e17\u0e31\u0e14<\/p>\n\n\n<div class=\"wp-block-syntaxhighlighter-code \"><pre class=\"brush: plain; title: ; notranslate\" title=\"\">\n#!\/bin\/bash\n<\/pre><\/div>\n\n\n<p>\u0e1a\u0e2d\u0e01\u0e23\u0e30\u0e1a\u0e1a\u0e27\u0e48\u0e32\u0e44\u0e1f\u0e25\u0e4c\u0e19\u0e35\u0e49\u0e40\u0e1b\u0e47\u0e19 <strong>\u0e2a\u0e04\u0e23\u0e34\u0e1b\u0e15\u0e4c bash<\/strong><\/p>\n\n\n<div class=\"wp-block-syntaxhighlighter-code \"><pre class=\"brush: plain; title: ; notranslate\" title=\"\">\n# ====== \u0e2b\u0e32\u0e42\u0e1f\u0e25\u0e40\u0e14\u0e2d\u0e23\u0e4c\u0e42\u0e1b\u0e23\u0e44\u0e1f\u0e25\u0e4c Firefox ======\nPROFILE_DIR=$(grep -E &#039;^Path=&#039; ~\/.mozilla\/firefox\/profiles.ini | head -n 1 | cut -d= -f2)\n<\/pre><\/div>\n\n\n<ul class=\"wp-block-list\">\n<li>Firefox \u0e08\u0e30\u0e40\u0e01\u0e47\u0e1a session\/tab \u0e40\u0e01\u0e48\u0e32\u0e44\u0e27\u0e49\u0e43\u0e19 <strong>\u0e42\u0e1f\u0e25\u0e40\u0e14\u0e2d\u0e23\u0e4c\u0e42\u0e1b\u0e23\u0e44\u0e1f\u0e25\u0e4c<\/strong><\/li>\n\n\n\n<li>\u0e04\u0e33\u0e2a\u0e31\u0e48\u0e07\u0e19\u0e35\u0e49\u0e43\u0e0a\u0e49 <code>grep<\/code> \u0e2b\u0e32\u0e41\u0e16\u0e27\u0e17\u0e35\u0e48\u0e02\u0e36\u0e49\u0e19\u0e15\u0e49\u0e19\u0e14\u0e49\u0e27\u0e22 <code>Path=<\/code> \u0e43\u0e19\u0e44\u0e1f\u0e25\u0e4c <code>profiles.ini<\/code> (\u0e0b\u0e36\u0e48\u0e07\u0e1a\u0e2d\u0e01\u0e15\u0e33\u0e41\u0e2b\u0e19\u0e48\u0e07\u0e42\u0e1b\u0e23\u0e44\u0e1f\u0e25\u0e4c)<\/li>\n\n\n\n<li><code>head -n 1<\/code> \u2192 \u0e40\u0e2d\u0e32\u0e40\u0e09\u0e1e\u0e32\u0e30\u0e1a\u0e23\u0e23\u0e17\u0e31\u0e14\u0e41\u0e23\u0e01 (\u0e01\u0e23\u0e13\u0e35\u0e21\u0e35\u0e2b\u0e25\u0e32\u0e22\u0e42\u0e1b\u0e23\u0e44\u0e1f\u0e25\u0e4c)<\/li>\n\n\n\n<li><code>cut -d= -f2<\/code> \u2192 \u0e15\u0e31\u0e14\u0e40\u0e2d\u0e32\u0e04\u0e48\u0e32 path \u0e2b\u0e25\u0e31\u0e07\u0e40\u0e04\u0e23\u0e37\u0e48\u0e2d\u0e07\u0e2b\u0e21\u0e32\u0e22 <code>=<\/code><\/li>\n\n\n\n<li>\u0e1c\u0e25\u0e25\u0e31\u0e1e\u0e18\u0e4c\u0e40\u0e01\u0e47\u0e1a\u0e43\u0e19\u0e15\u0e31\u0e27\u0e41\u0e1b\u0e23 <code>$PROFILE_DIR<\/code> \u0e40\u0e0a\u0e48\u0e19 <code>abcd1234.default-release<\/code><\/li>\n<\/ul>\n\n\n<div class=\"wp-block-syntaxhighlighter-code \"><pre class=\"brush: plain; title: ; notranslate\" title=\"\">\n# ====== \u0e25\u0e1a\u0e44\u0e1f\u0e25\u0e4c session \u0e40\u0e01\u0e48\u0e32 ======\nrm -f ~\/.mozilla\/firefox\/$PROFILE_DIR\/sessionstore.jsonlz4\nrm -f ~\/.mozilla\/firefox\/$PROFILE_DIR\/sessionCheckpoints.json\nrm -f ~\/.mozilla\/firefox\/$PROFILE_DIR\/recovery.jsonlz4\nrm -f ~\/.mozilla\/firefox\/$PROFILE_DIR\/recovery.baklz4\n<\/pre><\/div>\n\n\n<p>Firefox \u0e08\u0e30\u0e08\u0e33\u0e41\u0e17\u0e47\u0e1a\u0e17\u0e35\u0e48\u0e40\u0e1b\u0e34\u0e14\u0e25\u0e48\u0e32\u0e2a\u0e38\u0e14\u0e44\u0e27\u0e49\u0e43\u0e19\u0e44\u0e1f\u0e25\u0e4c\u0e1e\u0e27\u0e01\u0e19\u0e35\u0e49<\/p>\n\n\n\n<ul class=\"wp-block-list\">\n<li><code>sessionstore.jsonlz4<\/code> \u2192 \u0e40\u0e01\u0e47\u0e1a\u0e41\u0e17\u0e47\u0e1a\u0e17\u0e35\u0e48\u0e40\u0e1b\u0e34\u0e14\u0e25\u0e48\u0e32\u0e2a\u0e38\u0e14<\/li>\n\n\n\n<li><code>sessionCheckpoints.json<\/code> \u2192 \u0e40\u0e01\u0e47\u0e1a checkpoint \u0e02\u0e2d\u0e07 session<\/li>\n\n\n\n<li><code>recovery.jsonlz4<\/code> \u0e41\u0e25\u0e30 <code>recovery.baklz4<\/code> \u2192 \u0e40\u0e01\u0e47\u0e1a\u0e02\u0e49\u0e2d\u0e21\u0e39\u0e25\u0e01\u0e39\u0e49\u0e04\u0e37\u0e19 session \u0e40\u0e1c\u0e37\u0e48\u0e2d\u0e42\u0e1b\u0e23\u0e41\u0e01\u0e23\u0e21 crash<\/li>\n<\/ul>\n\n\n\n<p>\u0e01\u0e32\u0e23\u0e25\u0e1a\u0e44\u0e1f\u0e25\u0e4c\u0e40\u0e2b\u0e25\u0e48\u0e32\u0e19\u0e35\u0e49\u0e17\u0e34\u0e49\u0e07 = \u0e40\u0e04\u0e25\u0e35\u0e22\u0e23\u0e4c\u0e1b\u0e23\u0e30\u0e27\u0e31\u0e15\u0e34\u0e41\u0e17\u0e47\u0e1a\u0e17\u0e35\u0e48\u0e40\u0e1b\u0e34\u0e14\u0e44\u0e27\u0e49 \u2192 \u0e17\u0e33\u0e43\u0e2b\u0e49 Firefox \u0e40\u0e23\u0e34\u0e48\u0e21\u0e41\u0e1a\u0e1a \u201c\u0e2b\u0e19\u0e49\u0e32\u0e43\u0e2b\u0e21\u0e48\u201d<\/p>\n\n\n<div class=\"wp-block-syntaxhighlighter-code \"><pre class=\"brush: plain; title: ; notranslate\" title=\"\">\n# ====== \u0e40\u0e1b\u0e34\u0e14 Firefox \u0e41\u0e1a\u0e1a\u0e44\u0e21\u0e48\u0e43\u0e0a\u0e49 session \u0e40\u0e14\u0e34\u0e21 ======\nnohup firefox --new-instance --no-remote \\\n    http:\/\/test.com\/1.html \\\n    http:\/\/test.com\/2.html \\\n    http:\/\/test.com\/3.html \\\n    &gt;\/dev\/null 2&gt;&amp;amp;1 &amp;amp;\n<\/pre><\/div>\n\n\n<ul class=\"wp-block-list\">\n<li><code>nohup<\/code> \u2192 \u0e23\u0e31\u0e19\u0e42\u0e1b\u0e23\u0e41\u0e01\u0e23\u0e21\u0e42\u0e14\u0e22\u0e44\u0e21\u0e48\u0e1c\u0e39\u0e01\u0e01\u0e31\u0e1a terminal (\u0e44\u0e21\u0e48\u0e16\u0e39\u0e01 kill \u0e15\u0e2d\u0e19 logout\/autostart)<\/li>\n\n\n\n<li><code>firefox --new-instance --no-remote<\/code>\n<ul class=\"wp-block-list\">\n<li><code>--new-instance<\/code> \u2192 \u0e1a\u0e31\u0e07\u0e04\u0e31\u0e1a\u0e40\u0e1b\u0e34\u0e14 Firefox \u0e43\u0e2b\u0e21\u0e48 \u0e41\u0e21\u0e49\u0e21\u0e35 instance \u0e40\u0e14\u0e34\u0e21\u0e2d\u0e22\u0e39\u0e48<\/li>\n\n\n\n<li><code>--no-remote<\/code> \u2192 \u0e1b\u0e49\u0e2d\u0e07\u0e01\u0e31\u0e19\u0e44\u0e21\u0e48\u0e43\u0e2b\u0e49\u0e44\u0e1b reuse session \u0e40\u0e14\u0e34\u0e21<\/li>\n<\/ul>\n<\/li>\n\n\n\n<li>\u0e14\u0e49\u0e32\u0e19\u0e2b\u0e25\u0e31\u0e07\u0e40\u0e1b\u0e47\u0e19 <strong>URL \u0e17\u0e35\u0e48\u0e15\u0e49\u0e2d\u0e07\u0e01\u0e32\u0e23\u0e40\u0e1b\u0e34\u0e14\u0e43\u0e19\u0e41\u0e17\u0e47\u0e1a\u0e43\u0e2b\u0e21\u0e48<\/strong><\/li>\n\n\n\n<li><code>>\/dev\/null 2>&amp;1<\/code> \u2192 \u0e0b\u0e48\u0e2d\u0e19\u0e02\u0e49\u0e2d\u0e04\u0e27\u0e32\u0e21\u0e17\u0e35\u0e48 Firefox \u0e2a\u0e48\u0e07\u0e2d\u0e2d\u0e01\u0e21\u0e32 (\u0e17\u0e31\u0e49\u0e07 stdout \u0e41\u0e25\u0e30 stderr)<\/li>\n\n\n\n<li><code>&amp;<\/code> \u2192 \u0e23\u0e31\u0e19 Firefox \u0e40\u0e1b\u0e47\u0e19 background process \u0e17\u0e33\u0e43\u0e2b\u0e49\u0e2a\u0e04\u0e23\u0e34\u0e1b\u0e15\u0e4c\u0e44\u0e21\u0e48\u0e15\u0e49\u0e2d\u0e07\u0e23\u0e2d<\/li>\n<\/ul>\n\n\n\n<p> \u0e2a\u0e23\u0e38\u0e1b:<\/p>\n\n\n\n<ol class=\"wp-block-list\">\n<li>\u0e2a\u0e04\u0e23\u0e34\u0e1b\u0e15\u0e4c\u0e2b\u0e32\u0e15\u0e33\u0e41\u0e2b\u0e19\u0e48\u0e07\u0e42\u0e1f\u0e25\u0e40\u0e14\u0e2d\u0e23\u0e4c\u0e42\u0e1b\u0e23\u0e44\u0e1f\u0e25\u0e4c Firefox<\/li>\n\n\n\n<li>\u0e25\u0e1a\u0e44\u0e1f\u0e25\u0e4c session \u0e40\u0e14\u0e34\u0e21\u0e2d\u0e2d\u0e01 \u0e40\u0e1e\u0e37\u0e48\u0e2d\u0e44\u0e21\u0e48\u0e43\u0e2b\u0e49\u0e40\u0e1b\u0e34\u0e14\u0e41\u0e17\u0e47\u0e1a\u0e40\u0e01\u0e48\u0e32<\/li>\n\n\n\n<li>\u0e2a\u0e31\u0e48\u0e07 Firefox \u0e40\u0e1b\u0e34\u0e14\u0e43\u0e2b\u0e21\u0e48\u0e14\u0e49\u0e27\u0e22 URL \u0e17\u0e35\u0e48\u0e15\u0e49\u0e2d\u0e07\u0e01\u0e32\u0e23 \u0e42\u0e14\u0e22\u0e23\u0e31\u0e19\u0e41\u0e1a\u0e1a background \u0e44\u0e21\u0e48\u0e16\u0e39\u0e01 kill \u0e17\u0e34\u0e49\u0e07<\/li>\n<\/ol>\n\n\n\n<p><\/p>\n","protected":false},"excerpt":{"rendered":"<p>\u0e15\u0e49\u0e2d\u0e07\u0e2a\u0e23\u0e49\u0e32\u0e07\u0e44\u0e1f\u0e25\u0e4c .desktop \u0e43\u0e19\u0e42\u0e1f\u0e25\u0e40\u0e14\u0e2d\u0e23\u0e4c autostart \u0e02\u0e2d\u0e07 user: \u0e42 [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"closed","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"_editorskit_title_hidden":false,"_editorskit_reading_time":0,"_editorskit_is_block_options_detached":false,"_editorskit_block_options_position":"{}","footnotes":""},"categories":[105,163,9],"tags":[],"class_list":["post-326","post","type-post","status-publish","format-standard","hentry","category-centos","category-gui","category-linux"],"_links":{"self":[{"href":"https:\/\/blog.chaiyakul.com\/index.php\/wp-json\/wp\/v2\/posts\/326","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/blog.chaiyakul.com\/index.php\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/blog.chaiyakul.com\/index.php\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/blog.chaiyakul.com\/index.php\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/blog.chaiyakul.com\/index.php\/wp-json\/wp\/v2\/comments?post=326"}],"version-history":[{"count":1,"href":"https:\/\/blog.chaiyakul.com\/index.php\/wp-json\/wp\/v2\/posts\/326\/revisions"}],"predecessor-version":[{"id":327,"href":"https:\/\/blog.chaiyakul.com\/index.php\/wp-json\/wp\/v2\/posts\/326\/revisions\/327"}],"wp:attachment":[{"href":"https:\/\/blog.chaiyakul.com\/index.php\/wp-json\/wp\/v2\/media?parent=326"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/blog.chaiyakul.com\/index.php\/wp-json\/wp\/v2\/categories?post=326"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/blog.chaiyakul.com\/index.php\/wp-json\/wp\/v2\/tags?post=326"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}