literate-dotfiles/docs/systemd.html

538 lines
28 KiB
HTML
Raw Normal View History

2020-01-11 22:04:45 +01:00
<?xml version="1.0" encoding="utf-8"?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" lang="en" xml:lang="en">
<head>
2022-05-09 10:05:23 +02:00
<!-- 2022-05-09 lun. 10:04 -->
2020-01-11 22:04:45 +01:00
<meta http-equiv="Content-Type" content="text/html;charset=utf-8" />
2021-10-25 14:37:10 +02:00
<title>=systemd= services and timers</title>
2020-01-11 22:04:45 +01:00
<meta name="author" content="Dehaeze Thomas" />
2021-10-25 14:37:10 +02:00
<meta name="generator" content="Org Mode" />
2021-01-01 20:12:34 +01:00
<link rel="stylesheet" type="text/css" href="./dist/style.css"/>
<script type="text/javascript" src="./dist/script.js"></script>
2020-01-11 22:04:45 +01:00
</head>
<body>
<div id="org-div-home-and-up">
<a accesskey="h" href="./index.html"> UP </a>
|
<a accesskey="H" href="./index.html"> HOME </a>
2022-05-09 10:05:23 +02:00
</div><div id="content" class="content">
2021-01-01 20:12:34 +01:00
<h1 class="title"><code>systemd</code> services and timers</h1>
2022-05-09 10:05:23 +02:00
<div id="table-of-contents" role="doc-toc">
2020-01-11 22:04:45 +01:00
<h2>Table of Contents</h2>
2022-05-09 10:05:23 +02:00
<div id="text-table-of-contents" role="doc-toc">
2020-01-11 22:04:45 +01:00
<ul>
2022-05-09 10:05:23 +02:00
<li><a href="#orgbd1ef92"><code>braingit</code> - Automatic commit and push new brain pages</a>
2020-01-11 22:04:45 +01:00
<ul>
2022-05-09 10:05:23 +02:00
<li><a href="#orgea157a9">Service</a></li>
<li><a href="#org37b5dfc">Timer</a></li>
<li><a href="#org4da53fa">Script</a></li>
2020-01-11 22:04:45 +01:00
</ul>
</li>
2022-05-09 10:05:23 +02:00
<li><a href="#org0122dc5"><code>checkmail</code> - Check new mails</a>
2020-01-11 22:04:45 +01:00
<ul>
2022-05-09 10:05:23 +02:00
<li><a href="#org6104a46">Service</a></li>
<li><a href="#orgc84b1eb">Timer</a></li>
<li><a href="#org8c26f1e">Script</a></li>
2020-01-11 22:04:45 +01:00
</ul>
</li>
2022-05-09 10:05:23 +02:00
<li><a href="#org290b78f"><code>syncmail</code> - Synchronize all mails</a>
2020-01-11 22:04:45 +01:00
<ul>
2022-05-09 10:05:23 +02:00
<li><a href="#orgefd8c7b">Service</a></li>
<li><a href="#org9594653">Timer</a></li>
2020-01-11 22:04:45 +01:00
</ul>
</li>
2022-05-09 10:05:23 +02:00
<li><a href="#orgc224066"><code>vdirsyncer</code> - Synchronize calendar and contacts</a>
2020-01-11 22:04:45 +01:00
<ul>
2022-05-09 10:05:23 +02:00
<li><a href="#orgb44b558">Service</a></li>
<li><a href="#org088f759">Timer</a></li>
2020-01-11 22:04:45 +01:00
</ul>
</li>
2022-05-09 10:05:23 +02:00
<li><a href="#org632bc1c"><code>ssh-agent</code> - SSH Agent</a>
2020-01-11 22:04:45 +01:00
<ul>
2022-05-09 10:05:23 +02:00
<li><a href="#org9a8f7fb">Service</a></li>
2020-01-11 22:04:45 +01:00
</ul>
</li>
2022-05-09 10:05:23 +02:00
<li><a href="#orga057b5a"><code>emacs</code> - Emacs</a>
2020-01-11 22:04:45 +01:00
<ul>
2022-05-09 10:05:23 +02:00
<li><a href="#org4b91453">Service</a></li>
2020-01-28 21:32:38 +01:00
</ul>
</li>
2022-05-09 10:05:23 +02:00
<li><a href="#orge6f4a6a"><code>trash-empty</code> - Empty the trash for files older than 30 days</a>
2020-01-28 21:32:38 +01:00
<ul>
2022-05-09 10:05:23 +02:00
<li><a href="#orgfa6b7df">Service</a></li>
<li><a href="#org17be1c1">Timer</a></li>
2021-01-08 01:43:48 +01:00
</ul>
</li>
2022-05-09 10:05:23 +02:00
<li><a href="#orga1ff028"><code>syncthing</code></a>
2021-01-08 01:43:48 +01:00
<ul>
2022-05-09 10:05:23 +02:00
<li><a href="#orgcbf786a">Service</a></li>
2021-10-25 14:37:10 +02:00
</ul>
</li>
2022-05-09 10:05:23 +02:00
<li><a href="#orgefe060e"><code>homelab-tunnel</code> - SSH Tunnel</a>
2021-10-25 14:37:10 +02:00
<ul>
2022-05-09 10:05:23 +02:00
<li><a href="#org1be238b">Service</a></li>
</ul>
</li>
<li><a href="#orgd4332cd"><code>esrf-tunnel</code> - SSH Tunnel</a>
<ul>
<li><a href="#org02bdf60">Service</a></li>
2020-01-11 22:04:45 +01:00
</ul>
</li>
</ul>
</div>
</div>
<p>
<a href="https://www.digitalocean.com/community/tutorials/how-to-use-systemctl-to-manage-systemd-services-and-units">https://www.digitalocean.com/community/tutorials/how-to-use-systemctl-to-manage-systemd-services-and-units</a>
</p>
2022-05-09 10:05:23 +02:00
<div id="outline-container-orgbd1ef92" class="outline-2">
<h2 id="orgbd1ef92"><code>braingit</code> - Automatic commit and push new brain pages</h2>
<div class="outline-text-2" id="text-orgbd1ef92">
2020-01-11 22:04:45 +01:00
</div>
2022-05-09 10:05:23 +02:00
<div id="outline-container-orgea157a9" class="outline-3">
<h3 id="orgea157a9">Service</h3>
<div class="outline-text-3" id="text-orgea157a9">
2021-01-01 20:12:34 +01:00
<div class="org-src-container">
<pre class="src src-conf">[<span class="org-type">Unit</span>]
<span class="org-variable-name">Description</span>=Sync Brain Website everyday
<span class="org-variable-name">RefuseManualStart</span>=no
<span class="org-variable-name">RefuseManualStop</span>=yes
[<span class="org-type">Service</span>]
<span class="org-variable-name">Type</span>=oneshot
<span class="org-variable-name">ExecStart</span>=%h/.local/bin/brain_git_push
</pre>
</div>
2020-01-11 22:04:45 +01:00
</div>
2021-01-01 20:12:34 +01:00
</div>
2022-05-09 10:05:23 +02:00
<div id="outline-container-org37b5dfc" class="outline-3">
<h3 id="org37b5dfc">Timer</h3>
<div class="outline-text-3" id="text-org37b5dfc">
2021-01-01 20:12:34 +01:00
<div class="org-src-container">
<pre class="src src-conf">[<span class="org-type">Unit</span>]
<span class="org-variable-name">Description</span>=Sync Brain Website everyday
<span class="org-variable-name">RefuseManualStart</span>=no
<span class="org-variable-name">RefuseManualStop</span>=no
<span class="org-variable-name">Wants</span>=network-online.target
<span class="org-variable-name">After</span>=network-online.target
[<span class="org-type">Timer</span>]
<span class="org-variable-name">OnCalendar</span>=*-*-* <span class="org-highlight-numbers-number">16</span>:<span class="org-highlight-numbers-number">00</span>:<span class="org-highlight-numbers-number">00</span>
<span class="org-variable-name">Persistent</span>=true
<span class="org-variable-name">Unit</span>=braingit.service
[<span class="org-type">Install</span>]
<span class="org-variable-name">WantedBy</span>=default.target
</pre>
</div>
</div>
</div>
2022-05-09 10:05:23 +02:00
<div id="outline-container-org4da53fa" class="outline-3">
<h3 id="org4da53fa">Script</h3>
<div class="outline-text-3" id="text-org4da53fa">
2021-01-01 20:12:34 +01:00
<div class="org-src-container">
2022-05-09 10:05:23 +02:00
<pre class="src src-bash"><span class="org-type">cd</span> ~/Cloud/programming/brain-website/
2021-01-01 20:12:34 +01:00
<span class="org-keyword">if</span> <span class="org-rainbow-delimiters-depth-1">[</span><span class="org-rainbow-delimiters-depth-2">[</span> <span class="org-negation-char">!</span> -z $<span class="org-rainbow-delimiters-depth-3">(</span><span class="org-sh-quoted-exec">git</span> status -s content/<span class="org-rainbow-delimiters-depth-3">)</span> <span class="org-rainbow-delimiters-depth-2">]</span><span class="org-rainbow-delimiters-depth-1">]</span>
<span class="org-keyword">then</span>
<span class="org-type">git</span> add content static &amp;&amp; <span class="org-sh-escaped-newline">\</span>
<span class="org-type">git</span> commit -m <span class="org-string">"Update Content - </span><span class="org-string"><span class="org-sh-quoted-exec">$(</span></span><span class="org-sh-quoted-exec">date</span><span class="org-string"><span class="org-sh-quoted-exec"> +%F)</span></span><span class="org-string">"</span> &amp;&amp; <span class="org-sh-escaped-newline">\</span>
<span class="org-type">git</span> push
<span class="org-keyword">exit</span>
<span class="org-keyword">fi</span>
</pre>
</div>
</div>
</div>
</div>
2022-05-09 10:05:23 +02:00
<div id="outline-container-org0122dc5" class="outline-2">
<h2 id="org0122dc5"><code>checkmail</code> - Check new mails</h2>
<div class="outline-text-2" id="text-org0122dc5">
2021-01-01 20:12:34 +01:00
</div>
2022-05-09 10:05:23 +02:00
<div id="outline-container-org6104a46" class="outline-3">
<h3 id="org6104a46">Service</h3>
<div class="outline-text-3" id="text-org6104a46">
2020-01-11 22:04:45 +01:00
<div class="org-src-container">
2020-11-03 16:27:09 +01:00
<pre class="src src-conf">[<span class="org-type">Unit</span>]
<span class="org-variable-name">Description</span>=Check new mails
<span class="org-variable-name">RefuseManualStart</span>=no
<span class="org-variable-name">RefuseManualStop</span>=yes
[<span class="org-type">Service</span>]
<span class="org-variable-name">Type</span>=oneshot
<span class="org-variable-name">ExecStart</span>=%h/.local/bin/checkmail -q
2020-01-11 22:04:45 +01:00
</pre>
</div>
</div>
</div>
2022-05-09 10:05:23 +02:00
<div id="outline-container-orgc84b1eb" class="outline-3">
<h3 id="orgc84b1eb">Timer</h3>
<div class="outline-text-3" id="text-orgc84b1eb">
2020-01-11 22:04:45 +01:00
<div class="org-src-container">
2020-11-03 16:27:09 +01:00
<pre class="src src-conf">[<span class="org-type">Unit</span>]
<span class="org-variable-name">Description</span>=Check Mail every x minutes
<span class="org-variable-name">RefuseManualStart</span>=no
<span class="org-variable-name">RefuseManualStop</span>=no
<span class="org-variable-name">Wants</span>=network-online.target
<span class="org-variable-name">After</span>=network-online.target
<span class="org-variable-name">Requires</span>=checkmail.service
[<span class="org-type">Timer</span>]
<span class="org-variable-name">Persistent</span>=false
<span class="org-variable-name">OnBootSec</span>=2min
<span class="org-variable-name">OnUnitActiveSec</span>=5min
<span class="org-variable-name">AccuracySec</span>=2min
<span class="org-variable-name">Unit</span>=checkmail.service
[<span class="org-type">Install</span>]
<span class="org-variable-name">WantedBy</span>=default.target
2020-01-11 22:04:45 +01:00
</pre>
</div>
</div>
</div>
2022-05-09 10:05:23 +02:00
<div id="outline-container-org8c26f1e" class="outline-3">
<h3 id="org8c26f1e">Script</h3>
<div class="outline-text-3" id="text-org8c26f1e">
2020-01-11 22:04:45 +01:00
<div class="org-src-container">
2020-11-03 16:27:09 +01:00
<pre class="src src-bash"><span class="org-keyword">while</span> <span class="org-rainbow-delimiters-depth-1">[</span> -n <span class="org-string">"</span><span class="org-string"><span class="org-constant">$</span></span><span class="org-string"><span class="org-variable-name">1</span></span><span class="org-string">"</span> <span class="org-rainbow-delimiters-depth-1">]</span>; <span class="org-keyword">do</span> <span class="org-comment-delimiter"># </span><span class="org-comment">while loop starts</span>
<span class="org-keyword">case</span> <span class="org-string">"</span><span class="org-string"><span class="org-constant">$</span></span><span class="org-string"><span class="org-variable-name">1</span></span><span class="org-string">"</span><span class="org-keyword"> in</span>
-a) <span class="org-variable-name">opt_all</span>=<span class="org-string">'--all'</span> ;; <span class="org-comment-delimiter"># </span><span class="org-comment">Check All inboxes</span>
-v) <span class="org-variable-name">opt_verbose</span>=<span class="org-string">'--verbose'</span> ;; <span class="org-comment-delimiter"># </span><span class="org-comment">Verbose</span>
-q) <span class="org-variable-name">opt_quiet</span>=<span class="org-string">'--quiet'</span> ;; <span class="org-comment-delimiter"># </span><span class="org-comment">Quiet</span>
*) <span class="org-type">echo</span> <span class="org-string">"Option </span><span class="org-string"><span class="org-constant">$</span></span><span class="org-string"><span class="org-variable-name">1</span></span><span class="org-string"> not recognized"</span> ;; <span class="org-comment-delimiter"># </span><span class="org-comment">In case you typed a different option</span>
<span class="org-keyword">esac</span>
<span class="org-builtin">shift</span>
<span class="org-keyword">done</span>
<span class="org-comment-delimiter"># </span><span class="org-comment">=============================================================</span>
<span class="org-comment-delimiter"># </span><span class="org-comment">Count number of mails</span>
<span class="org-variable-name">gmail_old</span>=<span class="org-string">"</span><span class="org-string"><span class="org-sh-quoted-exec">$(</span></span><span class="org-sh-quoted-exec">ls</span><span class="org-string"><span class="org-sh-quoted-exec"> ~/.mail/gmail/Inbox/new | wc -l)</span></span><span class="org-string">"</span>
<span class="org-variable-name">esrf_old</span>=<span class="org-string">"</span><span class="org-string"><span class="org-sh-quoted-exec">$(</span></span><span class="org-sh-quoted-exec">ls</span><span class="org-string"><span class="org-sh-quoted-exec"> ~/.mail/esrf/Inbox/new | wc -l)</span></span><span class="org-string">"</span>
<span class="org-comment-delimiter"># </span><span class="org-comment">=============================================================</span>
<span class="org-comment-delimiter"># </span><span class="org-comment">=============================================================</span>
<span class="org-comment-delimiter"># </span><span class="org-comment">Retreive mails</span>
2022-05-09 10:05:23 +02:00
mbsync $<span class="org-variable-name">opt_all</span> $<span class="org-variable-name">opt_verbose</span> gmail-Home esrf-Home <span class="org-highlight-numbers-number">2</span>&gt;/tmp/mbsync.log
2020-11-03 16:27:09 +01:00
<span class="org-comment-delimiter"># </span><span class="org-comment">=============================================================</span>
<span class="org-comment-delimiter"># </span><span class="org-comment">=============================================================</span>
<span class="org-comment-delimiter"># </span><span class="org-comment">Count number of mails</span>
<span class="org-variable-name">gmail_new</span>=<span class="org-string">"</span><span class="org-string"><span class="org-sh-quoted-exec">$(</span></span><span class="org-sh-quoted-exec">ls</span><span class="org-string"><span class="org-sh-quoted-exec"> ~/.mail/gmail/Inbox/new | wc -l)</span></span><span class="org-string">"</span>
<span class="org-variable-name">esrf_new</span>=<span class="org-string">"</span><span class="org-string"><span class="org-sh-quoted-exec">$(</span></span><span class="org-sh-quoted-exec">ls</span><span class="org-string"><span class="org-sh-quoted-exec"> ~/.mail/esrf/Inbox/new | wc -l)</span></span><span class="org-string">"</span>
<span class="org-comment-delimiter"># </span><span class="org-comment">=============================================================</span>
<span class="org-comment-delimiter"># </span><span class="org-comment">=============================================================</span>
<span class="org-comment-delimiter"># </span><span class="org-comment">Total Number of new mails since last checking</span>
2022-05-09 10:05:23 +02:00
<span class="org-variable-name">new</span>=<span class="org-string">"</span><span class="org-string"><span class="org-sh-quoted-exec">$((</span></span><span class="org-string"><span class="org-constant"><span class="org-sh-quoted-exec">$</span></span></span><span class="org-string"><span class="org-variable-name"><span class="org-sh-quoted-exec">esrf_new</span></span></span><span class="org-string"><span class="org-sh-quoted-exec">+</span></span><span class="org-string"><span class="org-constant"><span class="org-sh-quoted-exec">$</span></span></span><span class="org-string"><span class="org-variable-name"><span class="org-sh-quoted-exec">gmail_new</span></span></span><span class="org-string"><span class="org-sh-quoted-exec">)</span></span><span class="org-string">)"</span>
<span class="org-variable-name">old</span>=<span class="org-string">"</span><span class="org-string"><span class="org-sh-quoted-exec">$((</span></span><span class="org-string"><span class="org-constant"><span class="org-sh-quoted-exec">$</span></span></span><span class="org-string"><span class="org-variable-name"><span class="org-sh-quoted-exec">esrf_old</span></span></span><span class="org-string"><span class="org-sh-quoted-exec">+</span></span><span class="org-string"><span class="org-constant"><span class="org-sh-quoted-exec">$</span></span></span><span class="org-string"><span class="org-variable-name"><span class="org-sh-quoted-exec">gmail_old</span></span></span><span class="org-string"><span class="org-sh-quoted-exec">)</span></span><span class="org-string">)"</span>
2020-11-03 16:27:09 +01:00
<span class="org-comment-delimiter"># </span><span class="org-comment">=============================================================</span>
<span class="org-comment-delimiter"># </span><span class="org-comment">=============================================================</span>
<span class="org-comment-delimiter"># </span><span class="org-comment">Notification</span>
<span class="org-keyword">if</span> <span class="org-rainbow-delimiters-depth-1">[</span> <span class="org-string">"</span><span class="org-string"><span class="org-constant">$</span></span><span class="org-string"><span class="org-variable-name">new</span></span><span class="org-string">"</span> -gt <span class="org-highlight-numbers-number">0</span> <span class="org-rainbow-delimiters-depth-1">]</span>; <span class="org-keyword">then</span>
2022-05-09 10:05:23 +02:00
notify-send --hint=string:x-dunst-stack-tag:fV84ivMi <span class="org-string">'Mails &#63215;'</span> <span class="org-string">"</span><span class="org-string"><span class="org-constant">$</span></span><span class="org-string"><span class="org-variable-name">new</span></span><span class="org-string"> new mail(s)"</span>
2020-11-03 16:27:09 +01:00
<span class="org-keyword">fi</span>
<span class="org-comment-delimiter"># </span><span class="org-comment">=============================================================</span>
<span class="org-comment-delimiter"># </span><span class="org-comment">=============================================================</span>
<span class="org-comment-delimiter"># </span><span class="org-comment">Indexation and Tags</span>
<span class="org-keyword">if</span> <span class="org-type">pgrep</span> -f <span class="org-string">'mu server'</span>; <span class="org-keyword">then</span>
emacsclient --eval <span class="org-string">'(mu4e-update-index)'</span>
<span class="org-keyword">else</span>
2022-05-09 10:05:23 +02:00
mu index -m ~/.mail $<span class="org-variable-name">opt_verbose</span> $<span class="org-variable-name">opt_quiet</span>
2020-11-03 16:27:09 +01:00
<span class="org-keyword">fi</span>
<span class="org-comment-delimiter"># </span><span class="org-comment">=============================================================</span>
2020-01-11 22:04:45 +01:00
</pre>
</div>
</div>
</div>
</div>
2022-05-09 10:05:23 +02:00
<div id="outline-container-org290b78f" class="outline-2">
<h2 id="org290b78f"><code>syncmail</code> - Synchronize all mails</h2>
<div class="outline-text-2" id="text-org290b78f">
2020-01-11 22:04:45 +01:00
</div>
2022-05-09 10:05:23 +02:00
<div id="outline-container-orgefd8c7b" class="outline-3">
<h3 id="orgefd8c7b">Service</h3>
<div class="outline-text-3" id="text-orgefd8c7b">
2020-01-11 22:04:45 +01:00
<div class="org-src-container">
2020-11-03 16:27:09 +01:00
<pre class="src src-conf">[<span class="org-type">Unit</span>]
<span class="org-variable-name">Description</span>=Sync all mails
<span class="org-variable-name">RefuseManualStart</span>=no
<span class="org-variable-name">RefuseManualStop</span>=yes
[<span class="org-type">Service</span>]
<span class="org-variable-name">Type</span>=oneshot
<span class="org-variable-name">ExecStart</span>=%h/.local/bin/checkmail -a -q
2020-01-11 22:04:45 +01:00
</pre>
</div>
</div>
</div>
2022-05-09 10:05:23 +02:00
<div id="outline-container-org9594653" class="outline-3">
<h3 id="org9594653">Timer</h3>
<div class="outline-text-3" id="text-org9594653">
2020-01-11 22:04:45 +01:00
<div class="org-src-container">
2020-11-03 16:27:09 +01:00
<pre class="src src-conf">[<span class="org-type">Unit</span>]
<span class="org-variable-name">Description</span>=Sync All Mails every x hours
<span class="org-variable-name">RefuseManualStart</span>=no
<span class="org-variable-name">RefuseManualStop</span>=no
<span class="org-variable-name">Wants</span>=network-online.target
<span class="org-variable-name">After</span>=network-online.target
<span class="org-variable-name">Requires</span>=syncmail.service
[<span class="org-type">Timer</span>]
<span class="org-variable-name">Persistent</span>=false
<span class="org-variable-name">OnBootSec</span>=30min
<span class="org-variable-name">OnUnitActiveSec</span>=300min
<span class="org-variable-name">AccuracySec</span>=10min
<span class="org-variable-name">Unit</span>=syncmail.service
[<span class="org-type">Install</span>]
<span class="org-variable-name">WantedBy</span>=default.target
2020-01-11 22:04:45 +01:00
</pre>
</div>
</div>
</div>
</div>
2022-05-09 10:05:23 +02:00
<div id="outline-container-orgc224066" class="outline-2">
<h2 id="orgc224066"><code>vdirsyncer</code> - Synchronize calendar and contacts</h2>
<div class="outline-text-2" id="text-orgc224066">
2020-01-11 22:04:45 +01:00
</div>
2022-05-09 10:05:23 +02:00
<div id="outline-container-orgb44b558" class="outline-3">
<h3 id="orgb44b558">Service</h3>
<div class="outline-text-3" id="text-orgb44b558">
2020-01-11 22:04:45 +01:00
<div class="org-src-container">
2020-11-03 16:27:09 +01:00
<pre class="src src-conf">[<span class="org-type">Unit</span>]
<span class="org-variable-name">Description</span>=Synchronize calendars and contacts
<span class="org-variable-name">Documentation</span>=https://vdirsyncer.readthedocs.org/
<span class="org-variable-name">Wants</span>=network-online.target
<span class="org-variable-name">After</span>=network-online.target
[<span class="org-type">Service</span>]
2021-10-25 14:37:10 +02:00
<span class="org-variable-name">ExecStart</span>=/home/thomas/.local/bin/vdirsyncer --verbosity <span class="org-string">"ERROR"</span> sync
2020-11-03 16:27:09 +01:00
<span class="org-variable-name">Type</span>=oneshot
2020-01-11 22:04:45 +01:00
</pre>
</div>
</div>
</div>
2022-05-09 10:05:23 +02:00
<div id="outline-container-org088f759" class="outline-3">
<h3 id="org088f759">Timer</h3>
<div class="outline-text-3" id="text-org088f759">
2020-01-11 22:04:45 +01:00
<div class="org-src-container">
2020-11-03 16:27:09 +01:00
<pre class="src src-conf">[<span class="org-type">Unit</span>]
<span class="org-variable-name">Description</span>=Synchronize vdirs
2020-01-11 22:04:45 +01:00
2020-11-03 16:27:09 +01:00
[<span class="org-type">Timer</span>]
<span class="org-variable-name">OnBootSec</span>=5m
<span class="org-variable-name">OnUnitActiveSec</span>=15m
<span class="org-variable-name">AccuracySec</span>=5m
2020-01-11 22:04:45 +01:00
2020-11-03 16:27:09 +01:00
[<span class="org-type">Install</span>]
<span class="org-variable-name">WantedBy</span>=timers.target
2020-01-11 22:04:45 +01:00
</pre>
</div>
</div>
</div>
</div>
2022-05-09 10:05:23 +02:00
<div id="outline-container-org632bc1c" class="outline-2">
<h2 id="org632bc1c"><code>ssh-agent</code> - SSH Agent</h2>
<div class="outline-text-2" id="text-org632bc1c">
2020-01-11 22:04:45 +01:00
</div>
2022-05-09 10:05:23 +02:00
<div id="outline-container-org9a8f7fb" class="outline-3">
<h3 id="org9a8f7fb">Service</h3>
<div class="outline-text-3" id="text-org9a8f7fb">
2020-01-11 22:04:45 +01:00
<div class="org-src-container">
2020-11-03 16:27:09 +01:00
<pre class="src src-conf">[<span class="org-type">Unit</span>]
<span class="org-variable-name">Description</span>=SSH key agent
2020-01-11 22:04:45 +01:00
2020-11-03 16:27:09 +01:00
[<span class="org-type">Service</span>]
<span class="org-variable-name">Type</span>=simple
<span class="org-variable-name">Environment</span>=SSH_AUTH_SOCK=%t/ssh-agent.socket
<span class="org-variable-name">ExecStart</span>=/usr/bin/ssh-agent -D -a $SSH_AUTH_SOCK
2020-01-11 22:04:45 +01:00
2020-11-03 16:27:09 +01:00
[<span class="org-type">Install</span>]
<span class="org-variable-name">WantedBy</span>=default.target
2020-01-11 22:04:45 +01:00
</pre>
</div>
</div>
</div>
</div>
2022-05-09 10:05:23 +02:00
<div id="outline-container-orga057b5a" class="outline-2">
<h2 id="orga057b5a"><code>emacs</code> - Emacs</h2>
<div class="outline-text-2" id="text-orga057b5a">
2020-01-11 22:04:45 +01:00
</div>
2022-05-09 10:05:23 +02:00
<div id="outline-container-org4b91453" class="outline-3">
<h3 id="org4b91453">Service</h3>
<div class="outline-text-3" id="text-org4b91453">
2021-01-08 01:43:48 +01:00
<div class="org-src-container">
<pre class="src src-conf">[<span class="org-type">Unit</span>]
<span class="org-variable-name">Description</span>=Emacs text editor
<span class="org-variable-name">Documentation</span>=info:emacs man:emacs(<span class="org-highlight-numbers-number">1</span>) https://gnu.org/software/emacs/
[<span class="org-type">Service</span>]
<span class="org-variable-name">Type</span>=simple
<span class="org-variable-name">ExecStart</span>=/usr/bin/emacs --fg-daemon
<span class="org-variable-name">ExecStop</span>=/usr/bin/emacsclient --eval <span class="org-string">"(kill-emacs)"</span>
<span class="org-variable-name">Environment</span>=SSH_AUTH_SOCK=%t/keyring/ssh
<span class="org-variable-name">Restart</span>=on-failure
[<span class="org-type">Install</span>]
<span class="org-variable-name">WantedBy</span>=default.target
</pre>
</div>
</div>
</div>
</div>
2021-10-25 14:37:10 +02:00
2022-05-09 10:05:23 +02:00
<div id="outline-container-orge6f4a6a" class="outline-2">
<h2 id="orge6f4a6a"><code>trash-empty</code> - Empty the trash for files older than 30 days</h2>
<div class="outline-text-2" id="text-orge6f4a6a">
2021-10-25 14:37:10 +02:00
</div>
2022-05-09 10:05:23 +02:00
<div id="outline-container-orgfa6b7df" class="outline-3">
<h3 id="orgfa6b7df">Service</h3>
<div class="outline-text-3" id="text-orgfa6b7df">
2021-10-25 14:37:10 +02:00
<div class="org-src-container">
<pre class="src src-conf">[<span class="org-type">Unit</span>]
<span class="org-variable-name">Description</span>=Empty the trash for files older than <span class="org-highlight-numbers-number">30</span> days
<span class="org-variable-name">Documentation</span>=https://github.com/andreafrancia/trash-cli
[<span class="org-type">Service</span>]
<span class="org-variable-name">ExecStart</span>=/home/thomas/.local/bin/trash-empty <span class="org-highlight-numbers-number">30</span>
<span class="org-variable-name">Type</span>=oneshot
</pre>
</div>
</div>
</div>
2022-05-09 10:05:23 +02:00
<div id="outline-container-org17be1c1" class="outline-3">
<h3 id="org17be1c1">Timer</h3>
<div class="outline-text-3" id="text-org17be1c1">
2021-10-25 14:37:10 +02:00
<div class="org-src-container">
<pre class="src src-conf">[<span class="org-type">Unit</span>]
<span class="org-variable-name">Description</span>=Empty trash
[<span class="org-type">Timer</span>]
<span class="org-variable-name">OnCalendar</span>=*-*-* <span class="org-highlight-numbers-number">16</span>:<span class="org-highlight-numbers-number">00</span>:<span class="org-highlight-numbers-number">00</span>
<span class="org-variable-name">Persistent</span>=true
<span class="org-variable-name">Unit</span>=trash-empty
[<span class="org-type">Install</span>]
<span class="org-variable-name">WantedBy</span>=timers.target
</pre>
</div>
</div>
</div>
</div>
2022-05-09 10:05:23 +02:00
<div id="outline-container-orga1ff028" class="outline-2">
<h2 id="orga1ff028"><code>syncthing</code></h2>
<div class="outline-text-2" id="text-orga1ff028">
</div>
<div id="outline-container-orgcbf786a" class="outline-3">
<h3 id="orgcbf786a">Service</h3>
<div class="outline-text-3" id="text-orgcbf786a">
<div class="org-src-container">
<pre class="src src-conf">[<span class="org-type">Unit</span>]
<span class="org-variable-name">Description</span>=Syncthing - Open Source Continuous File Synchronization for %I
<span class="org-variable-name">Documentation</span>=man:syncthing(<span class="org-highlight-numbers-number">1</span>)
<span class="org-variable-name">After</span>=network.target
[<span class="org-type">Service</span>]
<span class="org-variable-name">Environment</span>=<span class="org-string">"all_proxy=socks5://localhost:8080"</span>
<span class="org-variable-name">ExecStart</span>=/usr/bin/syncthing -no-browser -gui-address=<span class="org-string">"0.0.0.0:8384"</span> -no-restart -logflags=<span class="org-highlight-numbers-number">0</span>
<span class="org-variable-name">Restart</span>=on-failure
<span class="org-variable-name">SuccessExitStatus</span>=<span class="org-highlight-numbers-number">3</span> <span class="org-highlight-numbers-number">4</span>
<span class="org-variable-name">RestartForceExitStatus</span>=<span class="org-highlight-numbers-number">3</span> <span class="org-highlight-numbers-number">4</span>
[<span class="org-type">Install</span>]
<span class="org-variable-name">WantedBy</span>=default.target
</pre>
</div>
</div>
</div>
</div>
<div id="outline-container-orgefe060e" class="outline-2">
<h2 id="orgefe060e"><code>homelab-tunnel</code> - SSH Tunnel</h2>
<div class="outline-text-2" id="text-orgefe060e">
<p>
Useful to bypass firewalls.
This can we used on the browser:
</p>
<ul class="org-ul">
<li>for <code>qutebrowser</code>, use <code>:set content.proxy socks5://localhost:8080</code> (can setup a shortcut for that)</li>
</ul>
<p>
This is also used for Syncthing.
</p>
</div>
<div id="outline-container-org1be238b" class="outline-3">
<h3 id="org1be238b">Service</h3>
<div class="outline-text-3" id="text-org1be238b">
<div class="org-src-container">
<pre class="src src-conf">[<span class="org-type">Unit</span>]
<span class="org-variable-name">Description</span>=Setup a secure tunnel with homelab
<span class="org-variable-name">After</span>=network.target
[<span class="org-type">Service</span>]
<span class="org-variable-name">ExecStart</span>=/usr/bin/ssh -o ServerAliveInterval=<span class="org-highlight-numbers-number">60</span> -o ExitOnForwardFailure=yes -D <span class="org-highlight-numbers-number">8080</span> -q -N -T homelab
<span class="org-comment-delimiter"># </span><span class="org-comment">Restart every &gt;2 seconds to avoid StartLimitInterval failure</span>
<span class="org-variable-name">RestartSec</span>=<span class="org-highlight-numbers-number">5</span>
<span class="org-variable-name">Restart</span>=always
[<span class="org-type">Install</span>]
<span class="org-variable-name">WantedBy</span>=default.target
</pre>
</div>
</div>
</div>
</div>
<div id="outline-container-orgd4332cd" class="outline-2">
<h2 id="orgd4332cd"><code>esrf-tunnel</code> - SSH Tunnel</h2>
<div class="outline-text-2" id="text-orgd4332cd">
</div>
<div id="outline-container-org02bdf60" class="outline-3">
<h3 id="org02bdf60">Service</h3>
<div class="outline-text-3" id="text-org02bdf60">
<div class="org-src-container">
<pre class="src src-conf">[<span class="org-type">Unit</span>]
<span class="org-variable-name">Description</span>=Setup a secure tunnel with ESRF
<span class="org-variable-name">After</span>=network.target
[<span class="org-type">Service</span>]
<span class="org-variable-name">ExecStart</span>=/usr/bin/ssh -o ServerAliveInterval=<span class="org-highlight-numbers-number">60</span> -o ExitOnForwardFailure=yes -D <span class="org-highlight-numbers-number">8081</span> -q -N -T rnice.esrf.fr
<span class="org-comment-delimiter"># </span><span class="org-comment">Restart every &gt;2 seconds to avoid StartLimitInterval failure</span>
<span class="org-variable-name">RestartSec</span>=<span class="org-highlight-numbers-number">5</span>
<span class="org-variable-name">Restart</span>=always
[<span class="org-type">Install</span>]
<span class="org-variable-name">WantedBy</span>=default.target
</pre>
</div>
</div>
</div>
</div>
2020-01-28 21:32:38 +01:00
</div>
2020-01-11 22:04:45 +01:00
<div id="postamble" class="status">
<p class="author">Author: Dehaeze Thomas</p>
2022-05-09 10:05:23 +02:00
<p class="date">Created: 2022-05-09 lun. 10:04</p>
2020-01-11 22:04:45 +01:00
</div>
</body>
</html>