jekyll build from Action e92847840f
This commit is contained in:
parent
47150198e7
commit
93e0873f02
@ -402,6 +402,53 @@ So here I am and welcome to my first blog. Having a personal space on the Intern
|
||||
|
||||
|
||||
|
||||
<div class="grid__item">
|
||||
<article class="archive__item" itemscope itemtype="https://schema.org/CreativeWork">
|
||||
|
||||
<h2 class="archive__item-title no_toc" itemprop="headline">
|
||||
|
||||
<a href="/2023/01/15/hot-reloading-with-trap-and-kill.html" rel="permalink">Hot-Reload Long Running Shell Scripts (feat. trap / kill)
|
||||
</a>
|
||||
|
||||
</h2>
|
||||
|
||||
|
||||
<p class="page__meta">
|
||||
|
||||
|
||||
<span class="page__meta-date">
|
||||
<i class="far fa-fw fa-calendar-alt" aria-hidden="true"></i>
|
||||
|
||||
<time datetime="2023-01-15T21:48:08+00:00">January 15, 2023</time>
|
||||
</span>
|
||||
|
||||
|
||||
<span class="page__meta-sep"></span>
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
<span class="page__meta-readtime">
|
||||
<i class="far fa-fw fa-clock" aria-hidden="true"></i>
|
||||
|
||||
5 minute read
|
||||
|
||||
</span>
|
||||
|
||||
</p>
|
||||
|
||||
|
||||
<p class="archive__item-excerpt" itemprop="description">trap them and kill them!
|
||||
</p>
|
||||
</article>
|
||||
</div>
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
<div class="grid__item">
|
||||
<article class="archive__item" itemscope itemtype="https://schema.org/CreativeWork">
|
||||
|
||||
@ -539,52 +586,6 @@ Last week, I received an email from Let’s Encrypt reminding me to renew my cer
|
||||
</div>
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
<div class="grid__item">
|
||||
<article class="archive__item" itemscope itemtype="https://schema.org/CreativeWork">
|
||||
|
||||
<h2 class="archive__item-title no_toc" itemprop="headline">
|
||||
|
||||
<a href="/2022/03/03/never-get-trapped-in-grub-rescue-again.html" rel="permalink">Never Get Trapped in Grub Rescue Again!
|
||||
</a>
|
||||
|
||||
</h2>
|
||||
|
||||
|
||||
<p class="page__meta">
|
||||
|
||||
|
||||
<span class="page__meta-date">
|
||||
<i class="far fa-fw fa-calendar-alt" aria-hidden="true"></i>
|
||||
|
||||
<time datetime="2022-03-03T00:46:00+00:00">March 3, 2022</time>
|
||||
</span>
|
||||
|
||||
|
||||
<span class="page__meta-sep"></span>
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
<span class="page__meta-readtime">
|
||||
<i class="far fa-fw fa-clock" aria-hidden="true"></i>
|
||||
|
||||
4 minute read
|
||||
|
||||
</span>
|
||||
|
||||
</p>
|
||||
|
||||
|
||||
<p class="archive__item-excerpt" itemprop="description">Anytime I install a new system on my machine, I pray God for nothing bad happens. But it usually happens. When I reboot, I find myself in the “Grub rescue” m...</p>
|
||||
</article>
|
||||
</div>
|
||||
|
||||
|
||||
</div>
|
||||
</div>
|
||||
|
||||
@ -623,7 +624,7 @@ Last week, I received an email from Let’s Encrypt reminding me to renew my cer
|
||||
</ul>
|
||||
</div>
|
||||
|
||||
<div class="page__footer-copyright">© 2022 Şahin Akkaya's Personal Page. Powered by <a href="https://jekyllrb.com" rel="nofollow">Jekyll</a> & <a href="https://mademistakes.com/work/minimal-mistakes-jekyll-theme/" rel="nofollow">Minimal Mistakes</a>.</div>
|
||||
<div class="page__footer-copyright">© 2023 Şahin Akkaya's Personal Page. Powered by <a href="https://jekyllrb.com" rel="nofollow">Jekyll</a> & <a href="https://mademistakes.com/work/minimal-mistakes-jekyll-theme/" rel="nofollow">Minimal Mistakes</a>.</div>
|
||||
<div class="page__footer-copyright">
|
||||
Check out the <a href="https://github.com/Asocia/sahinakkayadotdev">code</a> of this site.
|
||||
</div>
|
||||
|
@ -430,6 +430,53 @@ util.lua: highlight<span class="o">(</span>group, properties<span class="o">)
|
||||
|
||||
|
||||
|
||||
<div class="grid__item">
|
||||
<article class="archive__item" itemscope itemtype="https://schema.org/CreativeWork">
|
||||
|
||||
<h2 class="archive__item-title no_toc" itemprop="headline">
|
||||
|
||||
<a href="/2023/01/15/hot-reloading-with-trap-and-kill.html" rel="permalink">Hot-Reload Long Running Shell Scripts (feat. trap / kill)
|
||||
</a>
|
||||
|
||||
</h2>
|
||||
|
||||
|
||||
<p class="page__meta">
|
||||
|
||||
|
||||
<span class="page__meta-date">
|
||||
<i class="far fa-fw fa-calendar-alt" aria-hidden="true"></i>
|
||||
|
||||
<time datetime="2023-01-15T21:48:08+00:00">January 15, 2023</time>
|
||||
</span>
|
||||
|
||||
|
||||
<span class="page__meta-sep"></span>
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
<span class="page__meta-readtime">
|
||||
<i class="far fa-fw fa-clock" aria-hidden="true"></i>
|
||||
|
||||
5 minute read
|
||||
|
||||
</span>
|
||||
|
||||
</p>
|
||||
|
||||
|
||||
<p class="archive__item-excerpt" itemprop="description">trap them and kill them!
|
||||
</p>
|
||||
</article>
|
||||
</div>
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
<div class="grid__item">
|
||||
<article class="archive__item" itemscope itemtype="https://schema.org/CreativeWork">
|
||||
|
||||
@ -567,52 +614,6 @@ Last week, I received an email from Let’s Encrypt reminding me to renew my cer
|
||||
</div>
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
<div class="grid__item">
|
||||
<article class="archive__item" itemscope itemtype="https://schema.org/CreativeWork">
|
||||
|
||||
<h2 class="archive__item-title no_toc" itemprop="headline">
|
||||
|
||||
<a href="/2022/03/03/never-get-trapped-in-grub-rescue-again.html" rel="permalink">Never Get Trapped in Grub Rescue Again!
|
||||
</a>
|
||||
|
||||
</h2>
|
||||
|
||||
|
||||
<p class="page__meta">
|
||||
|
||||
|
||||
<span class="page__meta-date">
|
||||
<i class="far fa-fw fa-calendar-alt" aria-hidden="true"></i>
|
||||
|
||||
<time datetime="2022-03-03T00:46:00+00:00">March 3, 2022</time>
|
||||
</span>
|
||||
|
||||
|
||||
<span class="page__meta-sep"></span>
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
<span class="page__meta-readtime">
|
||||
<i class="far fa-fw fa-clock" aria-hidden="true"></i>
|
||||
|
||||
4 minute read
|
||||
|
||||
</span>
|
||||
|
||||
</p>
|
||||
|
||||
|
||||
<p class="archive__item-excerpt" itemprop="description">Anytime I install a new system on my machine, I pray God for nothing bad happens. But it usually happens. When I reboot, I find myself in the “Grub rescue” m...</p>
|
||||
</article>
|
||||
</div>
|
||||
|
||||
|
||||
</div>
|
||||
</div>
|
||||
|
||||
@ -651,7 +652,7 @@ Last week, I received an email from Let’s Encrypt reminding me to renew my cer
|
||||
</ul>
|
||||
</div>
|
||||
|
||||
<div class="page__footer-copyright">© 2022 Şahin Akkaya's Personal Page. Powered by <a href="https://jekyllrb.com" rel="nofollow">Jekyll</a> & <a href="https://mademistakes.com/work/minimal-mistakes-jekyll-theme/" rel="nofollow">Minimal Mistakes</a>.</div>
|
||||
<div class="page__footer-copyright">© 2023 Şahin Akkaya's Personal Page. Powered by <a href="https://jekyllrb.com" rel="nofollow">Jekyll</a> & <a href="https://mademistakes.com/work/minimal-mistakes-jekyll-theme/" rel="nofollow">Minimal Mistakes</a>.</div>
|
||||
<div class="page__footer-copyright">
|
||||
Check out the <a href="https://github.com/Asocia/sahinakkayadotdev">code</a> of this site.
|
||||
</div>
|
||||
|
@ -552,6 +552,53 @@ WantedBy=multi-user.target
|
||||
|
||||
|
||||
|
||||
<div class="grid__item">
|
||||
<article class="archive__item" itemscope itemtype="https://schema.org/CreativeWork">
|
||||
|
||||
<h2 class="archive__item-title no_toc" itemprop="headline">
|
||||
|
||||
<a href="/2023/01/15/hot-reloading-with-trap-and-kill.html" rel="permalink">Hot-Reload Long Running Shell Scripts (feat. trap / kill)
|
||||
</a>
|
||||
|
||||
</h2>
|
||||
|
||||
|
||||
<p class="page__meta">
|
||||
|
||||
|
||||
<span class="page__meta-date">
|
||||
<i class="far fa-fw fa-calendar-alt" aria-hidden="true"></i>
|
||||
|
||||
<time datetime="2023-01-15T21:48:08+00:00">January 15, 2023</time>
|
||||
</span>
|
||||
|
||||
|
||||
<span class="page__meta-sep"></span>
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
<span class="page__meta-readtime">
|
||||
<i class="far fa-fw fa-clock" aria-hidden="true"></i>
|
||||
|
||||
5 minute read
|
||||
|
||||
</span>
|
||||
|
||||
</p>
|
||||
|
||||
|
||||
<p class="archive__item-excerpt" itemprop="description">trap them and kill them!
|
||||
</p>
|
||||
</article>
|
||||
</div>
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
<div class="grid__item">
|
||||
<article class="archive__item" itemscope itemtype="https://schema.org/CreativeWork">
|
||||
|
||||
@ -689,52 +736,6 @@ Last week, I received an email from Let’s Encrypt reminding me to renew my cer
|
||||
</div>
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
<div class="grid__item">
|
||||
<article class="archive__item" itemscope itemtype="https://schema.org/CreativeWork">
|
||||
|
||||
<h2 class="archive__item-title no_toc" itemprop="headline">
|
||||
|
||||
<a href="/2022/03/03/never-get-trapped-in-grub-rescue-again.html" rel="permalink">Never Get Trapped in Grub Rescue Again!
|
||||
</a>
|
||||
|
||||
</h2>
|
||||
|
||||
|
||||
<p class="page__meta">
|
||||
|
||||
|
||||
<span class="page__meta-date">
|
||||
<i class="far fa-fw fa-calendar-alt" aria-hidden="true"></i>
|
||||
|
||||
<time datetime="2022-03-03T00:46:00+00:00">March 3, 2022</time>
|
||||
</span>
|
||||
|
||||
|
||||
<span class="page__meta-sep"></span>
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
<span class="page__meta-readtime">
|
||||
<i class="far fa-fw fa-clock" aria-hidden="true"></i>
|
||||
|
||||
4 minute read
|
||||
|
||||
</span>
|
||||
|
||||
</p>
|
||||
|
||||
|
||||
<p class="archive__item-excerpt" itemprop="description">Anytime I install a new system on my machine, I pray God for nothing bad happens. But it usually happens. When I reboot, I find myself in the “Grub rescue” m...</p>
|
||||
</article>
|
||||
</div>
|
||||
|
||||
|
||||
</div>
|
||||
</div>
|
||||
|
||||
@ -773,7 +774,7 @@ Last week, I received an email from Let’s Encrypt reminding me to renew my cer
|
||||
</ul>
|
||||
</div>
|
||||
|
||||
<div class="page__footer-copyright">© 2022 Şahin Akkaya's Personal Page. Powered by <a href="https://jekyllrb.com" rel="nofollow">Jekyll</a> & <a href="https://mademistakes.com/work/minimal-mistakes-jekyll-theme/" rel="nofollow">Minimal Mistakes</a>.</div>
|
||||
<div class="page__footer-copyright">© 2023 Şahin Akkaya's Personal Page. Powered by <a href="https://jekyllrb.com" rel="nofollow">Jekyll</a> & <a href="https://mademistakes.com/work/minimal-mistakes-jekyll-theme/" rel="nofollow">Minimal Mistakes</a>.</div>
|
||||
<div class="page__footer-copyright">
|
||||
Check out the <a href="https://github.com/Asocia/sahinakkayadotdev">code</a> of this site.
|
||||
</div>
|
||||
|
@ -391,6 +391,53 @@ ffmpeg <span class="nt">-f</span> concat <span class="nt">-i</span> mylist.txt <
|
||||
|
||||
|
||||
|
||||
<div class="grid__item">
|
||||
<article class="archive__item" itemscope itemtype="https://schema.org/CreativeWork">
|
||||
|
||||
<h2 class="archive__item-title no_toc" itemprop="headline">
|
||||
|
||||
<a href="/2023/01/15/hot-reloading-with-trap-and-kill.html" rel="permalink">Hot-Reload Long Running Shell Scripts (feat. trap / kill)
|
||||
</a>
|
||||
|
||||
</h2>
|
||||
|
||||
|
||||
<p class="page__meta">
|
||||
|
||||
|
||||
<span class="page__meta-date">
|
||||
<i class="far fa-fw fa-calendar-alt" aria-hidden="true"></i>
|
||||
|
||||
<time datetime="2023-01-15T21:48:08+00:00">January 15, 2023</time>
|
||||
</span>
|
||||
|
||||
|
||||
<span class="page__meta-sep"></span>
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
<span class="page__meta-readtime">
|
||||
<i class="far fa-fw fa-clock" aria-hidden="true"></i>
|
||||
|
||||
5 minute read
|
||||
|
||||
</span>
|
||||
|
||||
</p>
|
||||
|
||||
|
||||
<p class="archive__item-excerpt" itemprop="description">trap them and kill them!
|
||||
</p>
|
||||
</article>
|
||||
</div>
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
<div class="grid__item">
|
||||
<article class="archive__item" itemscope itemtype="https://schema.org/CreativeWork">
|
||||
|
||||
@ -528,52 +575,6 @@ Last week, I received an email from Let’s Encrypt reminding me to renew my cer
|
||||
</div>
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
<div class="grid__item">
|
||||
<article class="archive__item" itemscope itemtype="https://schema.org/CreativeWork">
|
||||
|
||||
<h2 class="archive__item-title no_toc" itemprop="headline">
|
||||
|
||||
<a href="/2022/03/03/never-get-trapped-in-grub-rescue-again.html" rel="permalink">Never Get Trapped in Grub Rescue Again!
|
||||
</a>
|
||||
|
||||
</h2>
|
||||
|
||||
|
||||
<p class="page__meta">
|
||||
|
||||
|
||||
<span class="page__meta-date">
|
||||
<i class="far fa-fw fa-calendar-alt" aria-hidden="true"></i>
|
||||
|
||||
<time datetime="2022-03-03T00:46:00+00:00">March 3, 2022</time>
|
||||
</span>
|
||||
|
||||
|
||||
<span class="page__meta-sep"></span>
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
<span class="page__meta-readtime">
|
||||
<i class="far fa-fw fa-clock" aria-hidden="true"></i>
|
||||
|
||||
4 minute read
|
||||
|
||||
</span>
|
||||
|
||||
</p>
|
||||
|
||||
|
||||
<p class="archive__item-excerpt" itemprop="description">Anytime I install a new system on my machine, I pray God for nothing bad happens. But it usually happens. When I reboot, I find myself in the “Grub rescue” m...</p>
|
||||
</article>
|
||||
</div>
|
||||
|
||||
|
||||
</div>
|
||||
</div>
|
||||
|
||||
@ -612,7 +613,7 @@ Last week, I received an email from Let’s Encrypt reminding me to renew my cer
|
||||
</ul>
|
||||
</div>
|
||||
|
||||
<div class="page__footer-copyright">© 2022 Şahin Akkaya's Personal Page. Powered by <a href="https://jekyllrb.com" rel="nofollow">Jekyll</a> & <a href="https://mademistakes.com/work/minimal-mistakes-jekyll-theme/" rel="nofollow">Minimal Mistakes</a>.</div>
|
||||
<div class="page__footer-copyright">© 2023 Şahin Akkaya's Personal Page. Powered by <a href="https://jekyllrb.com" rel="nofollow">Jekyll</a> & <a href="https://mademistakes.com/work/minimal-mistakes-jekyll-theme/" rel="nofollow">Minimal Mistakes</a>.</div>
|
||||
<div class="page__footer-copyright">
|
||||
Check out the <a href="https://github.com/Asocia/sahinakkayadotdev">code</a> of this site.
|
||||
</div>
|
||||
|
@ -410,6 +410,53 @@ ssh <span class="nt">-p</span> 7777 homeuser@localhost
|
||||
|
||||
|
||||
|
||||
<div class="grid__item">
|
||||
<article class="archive__item" itemscope itemtype="https://schema.org/CreativeWork">
|
||||
|
||||
<h2 class="archive__item-title no_toc" itemprop="headline">
|
||||
|
||||
<a href="/2023/01/15/hot-reloading-with-trap-and-kill.html" rel="permalink">Hot-Reload Long Running Shell Scripts (feat. trap / kill)
|
||||
</a>
|
||||
|
||||
</h2>
|
||||
|
||||
|
||||
<p class="page__meta">
|
||||
|
||||
|
||||
<span class="page__meta-date">
|
||||
<i class="far fa-fw fa-calendar-alt" aria-hidden="true"></i>
|
||||
|
||||
<time datetime="2023-01-15T21:48:08+00:00">January 15, 2023</time>
|
||||
</span>
|
||||
|
||||
|
||||
<span class="page__meta-sep"></span>
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
<span class="page__meta-readtime">
|
||||
<i class="far fa-fw fa-clock" aria-hidden="true"></i>
|
||||
|
||||
5 minute read
|
||||
|
||||
</span>
|
||||
|
||||
</p>
|
||||
|
||||
|
||||
<p class="archive__item-excerpt" itemprop="description">trap them and kill them!
|
||||
</p>
|
||||
</article>
|
||||
</div>
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
<div class="grid__item">
|
||||
<article class="archive__item" itemscope itemtype="https://schema.org/CreativeWork">
|
||||
|
||||
@ -547,52 +594,6 @@ Last week, I received an email from Let’s Encrypt reminding me to renew my cer
|
||||
</div>
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
<div class="grid__item">
|
||||
<article class="archive__item" itemscope itemtype="https://schema.org/CreativeWork">
|
||||
|
||||
<h2 class="archive__item-title no_toc" itemprop="headline">
|
||||
|
||||
<a href="/2022/03/03/never-get-trapped-in-grub-rescue-again.html" rel="permalink">Never Get Trapped in Grub Rescue Again!
|
||||
</a>
|
||||
|
||||
</h2>
|
||||
|
||||
|
||||
<p class="page__meta">
|
||||
|
||||
|
||||
<span class="page__meta-date">
|
||||
<i class="far fa-fw fa-calendar-alt" aria-hidden="true"></i>
|
||||
|
||||
<time datetime="2022-03-03T00:46:00+00:00">March 3, 2022</time>
|
||||
</span>
|
||||
|
||||
|
||||
<span class="page__meta-sep"></span>
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
<span class="page__meta-readtime">
|
||||
<i class="far fa-fw fa-clock" aria-hidden="true"></i>
|
||||
|
||||
4 minute read
|
||||
|
||||
</span>
|
||||
|
||||
</p>
|
||||
|
||||
|
||||
<p class="archive__item-excerpt" itemprop="description">Anytime I install a new system on my machine, I pray God for nothing bad happens. But it usually happens. When I reboot, I find myself in the “Grub rescue” m...</p>
|
||||
</article>
|
||||
</div>
|
||||
|
||||
|
||||
</div>
|
||||
</div>
|
||||
|
||||
@ -631,7 +632,7 @@ Last week, I received an email from Let’s Encrypt reminding me to renew my cer
|
||||
</ul>
|
||||
</div>
|
||||
|
||||
<div class="page__footer-copyright">© 2022 Şahin Akkaya's Personal Page. Powered by <a href="https://jekyllrb.com" rel="nofollow">Jekyll</a> & <a href="https://mademistakes.com/work/minimal-mistakes-jekyll-theme/" rel="nofollow">Minimal Mistakes</a>.</div>
|
||||
<div class="page__footer-copyright">© 2023 Şahin Akkaya's Personal Page. Powered by <a href="https://jekyllrb.com" rel="nofollow">Jekyll</a> & <a href="https://mademistakes.com/work/minimal-mistakes-jekyll-theme/" rel="nofollow">Minimal Mistakes</a>.</div>
|
||||
<div class="page__footer-copyright">
|
||||
Check out the <a href="https://github.com/Asocia/sahinakkayadotdev">code</a> of this site.
|
||||
</div>
|
||||
|
@ -400,6 +400,53 @@ uselessuser@remote.host<span class="se">\'</span>s password:
|
||||
|
||||
|
||||
|
||||
<div class="grid__item">
|
||||
<article class="archive__item" itemscope itemtype="https://schema.org/CreativeWork">
|
||||
|
||||
<h2 class="archive__item-title no_toc" itemprop="headline">
|
||||
|
||||
<a href="/2023/01/15/hot-reloading-with-trap-and-kill.html" rel="permalink">Hot-Reload Long Running Shell Scripts (feat. trap / kill)
|
||||
</a>
|
||||
|
||||
</h2>
|
||||
|
||||
|
||||
<p class="page__meta">
|
||||
|
||||
|
||||
<span class="page__meta-date">
|
||||
<i class="far fa-fw fa-calendar-alt" aria-hidden="true"></i>
|
||||
|
||||
<time datetime="2023-01-15T21:48:08+00:00">January 15, 2023</time>
|
||||
</span>
|
||||
|
||||
|
||||
<span class="page__meta-sep"></span>
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
<span class="page__meta-readtime">
|
||||
<i class="far fa-fw fa-clock" aria-hidden="true"></i>
|
||||
|
||||
5 minute read
|
||||
|
||||
</span>
|
||||
|
||||
</p>
|
||||
|
||||
|
||||
<p class="archive__item-excerpt" itemprop="description">trap them and kill them!
|
||||
</p>
|
||||
</article>
|
||||
</div>
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
<div class="grid__item">
|
||||
<article class="archive__item" itemscope itemtype="https://schema.org/CreativeWork">
|
||||
|
||||
@ -537,52 +584,6 @@ Last week, I received an email from Let’s Encrypt reminding me to renew my cer
|
||||
</div>
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
<div class="grid__item">
|
||||
<article class="archive__item" itemscope itemtype="https://schema.org/CreativeWork">
|
||||
|
||||
<h2 class="archive__item-title no_toc" itemprop="headline">
|
||||
|
||||
<a href="/2022/03/03/never-get-trapped-in-grub-rescue-again.html" rel="permalink">Never Get Trapped in Grub Rescue Again!
|
||||
</a>
|
||||
|
||||
</h2>
|
||||
|
||||
|
||||
<p class="page__meta">
|
||||
|
||||
|
||||
<span class="page__meta-date">
|
||||
<i class="far fa-fw fa-calendar-alt" aria-hidden="true"></i>
|
||||
|
||||
<time datetime="2022-03-03T00:46:00+00:00">March 3, 2022</time>
|
||||
</span>
|
||||
|
||||
|
||||
<span class="page__meta-sep"></span>
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
<span class="page__meta-readtime">
|
||||
<i class="far fa-fw fa-clock" aria-hidden="true"></i>
|
||||
|
||||
4 minute read
|
||||
|
||||
</span>
|
||||
|
||||
</p>
|
||||
|
||||
|
||||
<p class="archive__item-excerpt" itemprop="description">Anytime I install a new system on my machine, I pray God for nothing bad happens. But it usually happens. When I reboot, I find myself in the “Grub rescue” m...</p>
|
||||
</article>
|
||||
</div>
|
||||
|
||||
|
||||
</div>
|
||||
</div>
|
||||
|
||||
@ -621,7 +622,7 @@ Last week, I received an email from Let’s Encrypt reminding me to renew my cer
|
||||
</ul>
|
||||
</div>
|
||||
|
||||
<div class="page__footer-copyright">© 2022 Şahin Akkaya's Personal Page. Powered by <a href="https://jekyllrb.com" rel="nofollow">Jekyll</a> & <a href="https://mademistakes.com/work/minimal-mistakes-jekyll-theme/" rel="nofollow">Minimal Mistakes</a>.</div>
|
||||
<div class="page__footer-copyright">© 2023 Şahin Akkaya's Personal Page. Powered by <a href="https://jekyllrb.com" rel="nofollow">Jekyll</a> & <a href="https://mademistakes.com/work/minimal-mistakes-jekyll-theme/" rel="nofollow">Minimal Mistakes</a>.</div>
|
||||
<div class="page__footer-copyright">
|
||||
Check out the <a href="https://github.com/Asocia/sahinakkayadotdev">code</a> of this site.
|
||||
</div>
|
||||
|
@ -435,6 +435,53 @@ grub-install <span class="nt">--efi-directory</span><span class="o">=</span>/boo
|
||||
|
||||
|
||||
|
||||
<div class="grid__item">
|
||||
<article class="archive__item" itemscope itemtype="https://schema.org/CreativeWork">
|
||||
|
||||
<h2 class="archive__item-title no_toc" itemprop="headline">
|
||||
|
||||
<a href="/2023/01/15/hot-reloading-with-trap-and-kill.html" rel="permalink">Hot-Reload Long Running Shell Scripts (feat. trap / kill)
|
||||
</a>
|
||||
|
||||
</h2>
|
||||
|
||||
|
||||
<p class="page__meta">
|
||||
|
||||
|
||||
<span class="page__meta-date">
|
||||
<i class="far fa-fw fa-calendar-alt" aria-hidden="true"></i>
|
||||
|
||||
<time datetime="2023-01-15T21:48:08+00:00">January 15, 2023</time>
|
||||
</span>
|
||||
|
||||
|
||||
<span class="page__meta-sep"></span>
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
<span class="page__meta-readtime">
|
||||
<i class="far fa-fw fa-clock" aria-hidden="true"></i>
|
||||
|
||||
5 minute read
|
||||
|
||||
</span>
|
||||
|
||||
</p>
|
||||
|
||||
|
||||
<p class="archive__item-excerpt" itemprop="description">trap them and kill them!
|
||||
</p>
|
||||
</article>
|
||||
</div>
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
<div class="grid__item">
|
||||
<article class="archive__item" itemscope itemtype="https://schema.org/CreativeWork">
|
||||
|
||||
@ -572,53 +619,6 @@ Last week, I received an email from Let’s Encrypt reminding me to renew my cer
|
||||
</div>
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
<div class="grid__item">
|
||||
<article class="archive__item" itemscope itemtype="https://schema.org/CreativeWork">
|
||||
|
||||
<h2 class="archive__item-title no_toc" itemprop="headline">
|
||||
|
||||
<a href="/2022/02/27/creating-a-useless-user.html" rel="permalink">Creating a <em>Useless</em> User
|
||||
</a>
|
||||
|
||||
</h2>
|
||||
|
||||
|
||||
<p class="page__meta">
|
||||
|
||||
|
||||
<span class="page__meta-date">
|
||||
<i class="far fa-fw fa-calendar-alt" aria-hidden="true"></i>
|
||||
|
||||
<time datetime="2022-02-27T13:40:00+00:00">February 27, 2022</time>
|
||||
</span>
|
||||
|
||||
|
||||
<span class="page__meta-sep"></span>
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
<span class="page__meta-readtime">
|
||||
<i class="far fa-fw fa-clock" aria-hidden="true"></i>
|
||||
|
||||
1 minute read
|
||||
|
||||
</span>
|
||||
|
||||
</p>
|
||||
|
||||
|
||||
<p class="archive__item-excerpt" itemprop="description">Story
|
||||
In my previous post, I explained how to do port forwarding to access some machine behind private network. I will use this method to fix some issues in ...</p>
|
||||
</article>
|
||||
</div>
|
||||
|
||||
|
||||
</div>
|
||||
</div>
|
||||
|
||||
@ -657,7 +657,7 @@ In my previous post, I explained how to do port forwarding to access some machin
|
||||
</ul>
|
||||
</div>
|
||||
|
||||
<div class="page__footer-copyright">© 2022 Şahin Akkaya's Personal Page. Powered by <a href="https://jekyllrb.com" rel="nofollow">Jekyll</a> & <a href="https://mademistakes.com/work/minimal-mistakes-jekyll-theme/" rel="nofollow">Minimal Mistakes</a>.</div>
|
||||
<div class="page__footer-copyright">© 2023 Şahin Akkaya's Personal Page. Powered by <a href="https://jekyllrb.com" rel="nofollow">Jekyll</a> & <a href="https://mademistakes.com/work/minimal-mistakes-jekyll-theme/" rel="nofollow">Minimal Mistakes</a>.</div>
|
||||
<div class="page__footer-copyright">
|
||||
Check out the <a href="https://github.com/Asocia/sahinakkayadotdev">code</a> of this site.
|
||||
</div>
|
||||
|
@ -393,6 +393,53 @@
|
||||
|
||||
|
||||
|
||||
<div class="grid__item">
|
||||
<article class="archive__item" itemscope itemtype="https://schema.org/CreativeWork">
|
||||
|
||||
<h2 class="archive__item-title no_toc" itemprop="headline">
|
||||
|
||||
<a href="/2023/01/15/hot-reloading-with-trap-and-kill.html" rel="permalink">Hot-Reload Long Running Shell Scripts (feat. trap / kill)
|
||||
</a>
|
||||
|
||||
</h2>
|
||||
|
||||
|
||||
<p class="page__meta">
|
||||
|
||||
|
||||
<span class="page__meta-date">
|
||||
<i class="far fa-fw fa-calendar-alt" aria-hidden="true"></i>
|
||||
|
||||
<time datetime="2023-01-15T21:48:08+00:00">January 15, 2023</time>
|
||||
</span>
|
||||
|
||||
|
||||
<span class="page__meta-sep"></span>
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
<span class="page__meta-readtime">
|
||||
<i class="far fa-fw fa-clock" aria-hidden="true"></i>
|
||||
|
||||
5 minute read
|
||||
|
||||
</span>
|
||||
|
||||
</p>
|
||||
|
||||
|
||||
<p class="archive__item-excerpt" itemprop="description">trap them and kill them!
|
||||
</p>
|
||||
</article>
|
||||
</div>
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
<div class="grid__item">
|
||||
<article class="archive__item" itemscope itemtype="https://schema.org/CreativeWork">
|
||||
|
||||
@ -529,53 +576,6 @@ that they are making Github Copilot available for everyone. Previously, it was i
|
||||
</div>
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
<div class="grid__item">
|
||||
<article class="archive__item" itemscope itemtype="https://schema.org/CreativeWork">
|
||||
|
||||
<h2 class="archive__item-title no_toc" itemprop="headline">
|
||||
|
||||
<a href="/2022/02/27/creating-a-useless-user.html" rel="permalink">Creating a <em>Useless</em> User
|
||||
</a>
|
||||
|
||||
</h2>
|
||||
|
||||
|
||||
<p class="page__meta">
|
||||
|
||||
|
||||
<span class="page__meta-date">
|
||||
<i class="far fa-fw fa-calendar-alt" aria-hidden="true"></i>
|
||||
|
||||
<time datetime="2022-02-27T13:40:00+00:00">February 27, 2022</time>
|
||||
</span>
|
||||
|
||||
|
||||
<span class="page__meta-sep"></span>
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
<span class="page__meta-readtime">
|
||||
<i class="far fa-fw fa-clock" aria-hidden="true"></i>
|
||||
|
||||
1 minute read
|
||||
|
||||
</span>
|
||||
|
||||
</p>
|
||||
|
||||
|
||||
<p class="archive__item-excerpt" itemprop="description">Story
|
||||
In my previous post, I explained how to do port forwarding to access some machine behind private network. I will use this method to fix some issues in ...</p>
|
||||
</article>
|
||||
</div>
|
||||
|
||||
|
||||
</div>
|
||||
</div>
|
||||
|
||||
@ -614,7 +614,7 @@ In my previous post, I explained how to do port forwarding to access some machin
|
||||
</ul>
|
||||
</div>
|
||||
|
||||
<div class="page__footer-copyright">© 2022 Şahin Akkaya's Personal Page. Powered by <a href="https://jekyllrb.com" rel="nofollow">Jekyll</a> & <a href="https://mademistakes.com/work/minimal-mistakes-jekyll-theme/" rel="nofollow">Minimal Mistakes</a>.</div>
|
||||
<div class="page__footer-copyright">© 2023 Şahin Akkaya's Personal Page. Powered by <a href="https://jekyllrb.com" rel="nofollow">Jekyll</a> & <a href="https://mademistakes.com/work/minimal-mistakes-jekyll-theme/" rel="nofollow">Minimal Mistakes</a>.</div>
|
||||
<div class="page__footer-copyright">
|
||||
Check out the <a href="https://github.com/Asocia/sahinakkayadotdev">code</a> of this site.
|
||||
</div>
|
||||
|
@ -399,6 +399,53 @@ problem. That is your problem not understanding how licenses work. Stop complain
|
||||
|
||||
|
||||
|
||||
<div class="grid__item">
|
||||
<article class="archive__item" itemscope itemtype="https://schema.org/CreativeWork">
|
||||
|
||||
<h2 class="archive__item-title no_toc" itemprop="headline">
|
||||
|
||||
<a href="/2023/01/15/hot-reloading-with-trap-and-kill.html" rel="permalink">Hot-Reload Long Running Shell Scripts (feat. trap / kill)
|
||||
</a>
|
||||
|
||||
</h2>
|
||||
|
||||
|
||||
<p class="page__meta">
|
||||
|
||||
|
||||
<span class="page__meta-date">
|
||||
<i class="far fa-fw fa-calendar-alt" aria-hidden="true"></i>
|
||||
|
||||
<time datetime="2023-01-15T21:48:08+00:00">January 15, 2023</time>
|
||||
</span>
|
||||
|
||||
|
||||
<span class="page__meta-sep"></span>
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
<span class="page__meta-readtime">
|
||||
<i class="far fa-fw fa-clock" aria-hidden="true"></i>
|
||||
|
||||
5 minute read
|
||||
|
||||
</span>
|
||||
|
||||
</p>
|
||||
|
||||
|
||||
<p class="archive__item-excerpt" itemprop="description">trap them and kill them!
|
||||
</p>
|
||||
</article>
|
||||
</div>
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
<div class="grid__item">
|
||||
<article class="archive__item" itemscope itemtype="https://schema.org/CreativeWork">
|
||||
|
||||
@ -535,53 +582,6 @@ Last week, I received an email from Let’s Encrypt reminding me to renew my cer
|
||||
</div>
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
<div class="grid__item">
|
||||
<article class="archive__item" itemscope itemtype="https://schema.org/CreativeWork">
|
||||
|
||||
<h2 class="archive__item-title no_toc" itemprop="headline">
|
||||
|
||||
<a href="/2022/02/27/creating-a-useless-user.html" rel="permalink">Creating a <em>Useless</em> User
|
||||
</a>
|
||||
|
||||
</h2>
|
||||
|
||||
|
||||
<p class="page__meta">
|
||||
|
||||
|
||||
<span class="page__meta-date">
|
||||
<i class="far fa-fw fa-calendar-alt" aria-hidden="true"></i>
|
||||
|
||||
<time datetime="2022-02-27T13:40:00+00:00">February 27, 2022</time>
|
||||
</span>
|
||||
|
||||
|
||||
<span class="page__meta-sep"></span>
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
<span class="page__meta-readtime">
|
||||
<i class="far fa-fw fa-clock" aria-hidden="true"></i>
|
||||
|
||||
1 minute read
|
||||
|
||||
</span>
|
||||
|
||||
</p>
|
||||
|
||||
|
||||
<p class="archive__item-excerpt" itemprop="description">Story
|
||||
In my previous post, I explained how to do port forwarding to access some machine behind private network. I will use this method to fix some issues in ...</p>
|
||||
</article>
|
||||
</div>
|
||||
|
||||
|
||||
</div>
|
||||
</div>
|
||||
|
||||
@ -620,7 +620,7 @@ In my previous post, I explained how to do port forwarding to access some machin
|
||||
</ul>
|
||||
</div>
|
||||
|
||||
<div class="page__footer-copyright">© 2022 Şahin Akkaya's Personal Page. Powered by <a href="https://jekyllrb.com" rel="nofollow">Jekyll</a> & <a href="https://mademistakes.com/work/minimal-mistakes-jekyll-theme/" rel="nofollow">Minimal Mistakes</a>.</div>
|
||||
<div class="page__footer-copyright">© 2023 Şahin Akkaya's Personal Page. Powered by <a href="https://jekyllrb.com" rel="nofollow">Jekyll</a> & <a href="https://mademistakes.com/work/minimal-mistakes-jekyll-theme/" rel="nofollow">Minimal Mistakes</a>.</div>
|
||||
<div class="page__footer-copyright">
|
||||
Check out the <a href="https://github.com/Asocia/sahinakkayadotdev">code</a> of this site.
|
||||
</div>
|
||||
|
@ -361,7 +361,8 @@
|
||||
">Previous</a>
|
||||
|
||||
|
||||
<a href="#" class="pagination--pager disabled">Next</a>
|
||||
<a href="/2023/01/15/hot-reloading-with-trap-and-kill.html" class="pagination--pager" title="Hot-Reload Long Running Shell Scripts (feat. trap / kill)
|
||||
">Next</a>
|
||||
|
||||
</nav>
|
||||
|
||||
@ -380,6 +381,53 @@
|
||||
|
||||
|
||||
|
||||
<div class="grid__item">
|
||||
<article class="archive__item" itemscope itemtype="https://schema.org/CreativeWork">
|
||||
|
||||
<h2 class="archive__item-title no_toc" itemprop="headline">
|
||||
|
||||
<a href="/2023/01/15/hot-reloading-with-trap-and-kill.html" rel="permalink">Hot-Reload Long Running Shell Scripts (feat. trap / kill)
|
||||
</a>
|
||||
|
||||
</h2>
|
||||
|
||||
|
||||
<p class="page__meta">
|
||||
|
||||
|
||||
<span class="page__meta-date">
|
||||
<i class="far fa-fw fa-calendar-alt" aria-hidden="true"></i>
|
||||
|
||||
<time datetime="2023-01-15T21:48:08+00:00">January 15, 2023</time>
|
||||
</span>
|
||||
|
||||
|
||||
<span class="page__meta-sep"></span>
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
<span class="page__meta-readtime">
|
||||
<i class="far fa-fw fa-clock" aria-hidden="true"></i>
|
||||
|
||||
5 minute read
|
||||
|
||||
</span>
|
||||
|
||||
</p>
|
||||
|
||||
|
||||
<p class="archive__item-excerpt" itemprop="description">trap them and kill them!
|
||||
</p>
|
||||
</article>
|
||||
</div>
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
<div class="grid__item">
|
||||
<article class="archive__item" itemscope itemtype="https://schema.org/CreativeWork">
|
||||
|
||||
@ -516,53 +564,6 @@ Last week, I received an email from Let’s Encrypt reminding me to renew my cer
|
||||
</div>
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
<div class="grid__item">
|
||||
<article class="archive__item" itemscope itemtype="https://schema.org/CreativeWork">
|
||||
|
||||
<h2 class="archive__item-title no_toc" itemprop="headline">
|
||||
|
||||
<a href="/2022/02/27/creating-a-useless-user.html" rel="permalink">Creating a <em>Useless</em> User
|
||||
</a>
|
||||
|
||||
</h2>
|
||||
|
||||
|
||||
<p class="page__meta">
|
||||
|
||||
|
||||
<span class="page__meta-date">
|
||||
<i class="far fa-fw fa-calendar-alt" aria-hidden="true"></i>
|
||||
|
||||
<time datetime="2022-02-27T13:40:00+00:00">February 27, 2022</time>
|
||||
</span>
|
||||
|
||||
|
||||
<span class="page__meta-sep"></span>
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
<span class="page__meta-readtime">
|
||||
<i class="far fa-fw fa-clock" aria-hidden="true"></i>
|
||||
|
||||
1 minute read
|
||||
|
||||
</span>
|
||||
|
||||
</p>
|
||||
|
||||
|
||||
<p class="archive__item-excerpt" itemprop="description">Story
|
||||
In my previous post, I explained how to do port forwarding to access some machine behind private network. I will use this method to fix some issues in ...</p>
|
||||
</article>
|
||||
</div>
|
||||
|
||||
|
||||
</div>
|
||||
</div>
|
||||
|
||||
@ -601,7 +602,7 @@ In my previous post, I explained how to do port forwarding to access some machin
|
||||
</ul>
|
||||
</div>
|
||||
|
||||
<div class="page__footer-copyright">© 2022 Şahin Akkaya's Personal Page. Powered by <a href="https://jekyllrb.com" rel="nofollow">Jekyll</a> & <a href="https://mademistakes.com/work/minimal-mistakes-jekyll-theme/" rel="nofollow">Minimal Mistakes</a>.</div>
|
||||
<div class="page__footer-copyright">© 2023 Şahin Akkaya's Personal Page. Powered by <a href="https://jekyllrb.com" rel="nofollow">Jekyll</a> & <a href="https://mademistakes.com/work/minimal-mistakes-jekyll-theme/" rel="nofollow">Minimal Mistakes</a>.</div>
|
||||
<div class="page__footer-copyright">
|
||||
Check out the <a href="https://github.com/Asocia/sahinakkayadotdev">code</a> of this site.
|
||||
</div>
|
||||
|
840
2023/01/15/hot-reloading-with-trap-and-kill.html
Normal file
840
2023/01/15/hot-reloading-with-trap-and-kill.html
Normal file
@ -0,0 +1,840 @@
|
||||
<!doctype html>
|
||||
<!--
|
||||
Minimal Mistakes Jekyll Theme 4.24.0 by Michael Rose
|
||||
Copyright 2013-2020 Michael Rose - mademistakes.com | @mmistakes
|
||||
Free for personal and commercial use under the MIT license
|
||||
https://github.com/mmistakes/minimal-mistakes/blob/master/LICENSE
|
||||
-->
|
||||
<html lang="en" class="no-js">
|
||||
<head>
|
||||
<meta charset="utf-8">
|
||||
|
||||
<!-- begin _includes/seo.html --><title>Hot-Reload Long Running Shell Scripts (feat. trap / kill) - Şahin Akkaya’s Personal Page</title>
|
||||
<meta name="description" content="trap them and kill them!">
|
||||
|
||||
|
||||
<meta name="author" content="Şahin Akkaya">
|
||||
|
||||
<meta property="article:author" content="Şahin Akkaya">
|
||||
|
||||
|
||||
|
||||
<meta property="og:type" content="article">
|
||||
<meta property="og:locale" content="en_US">
|
||||
<meta property="og:site_name" content="Şahin Akkaya's Personal Page">
|
||||
<meta property="og:title" content="Hot-Reload Long Running Shell Scripts (feat. trap / kill)">
|
||||
<meta property="og:url" content="https://sahinakkaya.dev/2023/01/15/hot-reloading-with-trap-and-kill.html">
|
||||
|
||||
|
||||
<meta property="og:description" content="trap them and kill them!">
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
<meta property="article:published_time" content="2023-01-15T21:48:08+00:00">
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
<link rel="canonical" href="https://sahinakkaya.dev/2023/01/15/hot-reloading-with-trap-and-kill.html">
|
||||
|
||||
|
||||
|
||||
|
||||
<script type="application/ld+json">
|
||||
{
|
||||
"@context": "https://schema.org",
|
||||
|
||||
"@type": "Person",
|
||||
"name": null,
|
||||
"url": "https://sahinakkaya.dev/"
|
||||
|
||||
}
|
||||
</script>
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
<!-- end _includes/seo.html -->
|
||||
|
||||
|
||||
|
||||
<link href="/feed.xml" type="application/atom+xml" rel="alternate" title="Şahin Akkaya's Personal Page Feed">
|
||||
|
||||
|
||||
<!-- https://t.co/dKP3o1e -->
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
||||
|
||||
<script>
|
||||
document.documentElement.className = document.documentElement.className.replace(/\bno-js\b/g, '') + ' js ';
|
||||
</script>
|
||||
|
||||
<!-- For all browsers -->
|
||||
<link rel="stylesheet" href="/assets/css/main.css">
|
||||
<link rel="preload" href="https://cdn.jsdelivr.net/npm/@fortawesome/fontawesome-free@5/css/all.min.css" as="style" onload="this.onload=null;this.rel='stylesheet'">
|
||||
<noscript><link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/@fortawesome/fontawesome-free@5/css/all.min.css"></noscript>
|
||||
|
||||
|
||||
|
||||
<!-- start custom head snippets -->
|
||||
|
||||
<!-- insert favicons. use https://realfavicongenerator.net/ -->
|
||||
|
||||
<!-- end custom head snippets -->
|
||||
|
||||
</head>
|
||||
|
||||
<body class="layout--single">
|
||||
<nav class="skip-links">
|
||||
<ul>
|
||||
<li><a href="#site-nav" class="screen-reader-shortcut">Skip to primary navigation</a></li>
|
||||
<li><a href="#main" class="screen-reader-shortcut">Skip to content</a></li>
|
||||
<li><a href="#footer" class="screen-reader-shortcut">Skip to footer</a></li>
|
||||
</ul>
|
||||
</nav>
|
||||
|
||||
<!--[if lt IE 9]>
|
||||
<div class="notice--danger align-center" style="margin: 0;">You are using an <strong>outdated</strong> browser. Please <a href="https://browsehappy.com/">upgrade your browser</a> to improve your experience.</div>
|
||||
<![endif]-->
|
||||
|
||||
|
||||
|
||||
<div class="masthead">
|
||||
<div class="masthead__inner-wrap">
|
||||
<div class="masthead__menu">
|
||||
<nav id="site-nav" class="greedy-nav">
|
||||
|
||||
<a class="site-title" href="/">
|
||||
/home/sahin/
|
||||
|
||||
</a>
|
||||
<ul class="visible-links"><li class="masthead__menu-item">
|
||||
<a href="/">Home</a>
|
||||
</li><li class="masthead__menu-item">
|
||||
<a href="/about/">About</a>
|
||||
</li><li class="masthead__menu-item">
|
||||
<a href="/contact/">Contact</a>
|
||||
</li></ul>
|
||||
|
||||
<button class="search__toggle" type="button">
|
||||
<span class="visually-hidden">Toggle search</span>
|
||||
<i class="fas fa-search"></i>
|
||||
</button>
|
||||
|
||||
<button class="greedy-nav__toggle hidden" type="button">
|
||||
<span class="visually-hidden">Toggle menu</span>
|
||||
<div class="navicon"></div>
|
||||
</button>
|
||||
<ul class="hidden-links hidden"></ul>
|
||||
</nav>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
|
||||
<div class="initial-content">
|
||||
|
||||
|
||||
|
||||
|
||||
<div id="main" role="main">
|
||||
|
||||
<div class="sidebar sticky">
|
||||
|
||||
|
||||
|
||||
<div itemscope itemtype="https://schema.org/Person">
|
||||
|
||||
|
||||
<div class="author__avatar">
|
||||
|
||||
<img src="/assets/images/logo.jpg" alt="Şahin Akkaya" itemprop="image">
|
||||
|
||||
</div>
|
||||
|
||||
|
||||
<div class="author__content">
|
||||
|
||||
<h3 class="author__name" itemprop="name">Şahin Akkaya</h3>
|
||||
|
||||
|
||||
<div class="author__bio" itemprop="description">
|
||||
<p>A perfectionist who likes to tinker everything until it is just right.</p>
|
||||
|
||||
</div>
|
||||
|
||||
</div>
|
||||
|
||||
<div class="author__urls-wrapper">
|
||||
<button class="btn btn--inverse">Follow</button>
|
||||
<ul class="author__urls social-icons">
|
||||
|
||||
<li itemprop="homeLocation" itemscope itemtype="https://schema.org/Place">
|
||||
<i class="fas fa-fw fa-map-marker-alt" aria-hidden="true"></i> <span itemprop="name">Istanbul, Turkey</span>
|
||||
</li>
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
<li><a href="https://github.com/sahinakkayadev" rel="nofollow noopener noreferrer"><i class="fab fa-fw fa-github" aria-hidden="true"></i><span class="label">sahinakkayadev</span></a></li>
|
||||
|
||||
|
||||
|
||||
<li><a href="https://stackoverflow.com/users/9608759" rel="nofollow noopener noreferrer"><i class="fab fa-fw fa-stack-overflow" aria-hidden="true"></i><span class="label">Asocia</span></a></li>
|
||||
|
||||
|
||||
|
||||
<li><a href="https://twitter.com/sahinakkayadev" rel="nofollow noopener noreferrer"><i class="fab fa-fw fa-twitter-square" aria-hidden="true"></i><span class="label">@sahinakkayadev</span></a></li>
|
||||
|
||||
|
||||
|
||||
<li><a href="mailto:sahin@sahinakkaya.dev" rel="nofollow noopener noreferrer"><i class="fas fa-fw fa-envelope" aria-hidden="true"></i><span class="label">sahin@sahinakkaya.dev</span></a></li>
|
||||
|
||||
|
||||
|
||||
<li><a href="/assets/docs/resume.pdf" rel="nofollow noopener noreferrer"><i class="fas fa-fw fa-id-card" aria-hidden="true"></i><span class="label">Resume</span></a></li>
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
<!--
|
||||
<li>
|
||||
<a href="http://link-to-whatever-social-network.com/user/" itemprop="sameAs" rel="nofollow noopener noreferrer">
|
||||
<i class="fas fa-fw" aria-hidden="true"></i> Custom Social Profile Link
|
||||
</a>
|
||||
</li>
|
||||
-->
|
||||
</ul>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
|
||||
</div>
|
||||
|
||||
|
||||
|
||||
<article class="page" itemscope itemtype="https://schema.org/CreativeWork">
|
||||
<meta itemprop="headline" content="Hot-Reload Long Running Shell Scripts (feat. trap / kill)">
|
||||
<meta itemprop="description" content="trap them and kill them!">
|
||||
<meta itemprop="datePublished" content="2023-01-15T21:48:08+00:00">
|
||||
|
||||
|
||||
<div class="page__inner-wrap">
|
||||
|
||||
<header>
|
||||
<h1 id="page-title" class="page__title" itemprop="headline">Hot-Reload Long Running Shell Scripts (feat. trap / kill)
|
||||
</h1>
|
||||
|
||||
|
||||
<p class="page__meta">
|
||||
|
||||
|
||||
<span class="page__meta-date">
|
||||
<i class="far fa-calendar-alt" aria-hidden="true"></i>
|
||||
|
||||
<time datetime="2023-01-15T21:48:08+00:00">January 15, 2023</time>
|
||||
</span>
|
||||
|
||||
|
||||
<span class="page__meta-sep"></span>
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
<span class="page__meta-readtime">
|
||||
<i class="far fa-clock" aria-hidden="true"></i>
|
||||
|
||||
5 minute read
|
||||
|
||||
</span>
|
||||
|
||||
</p>
|
||||
|
||||
|
||||
</header>
|
||||
|
||||
|
||||
<section class="page__content" itemprop="text">
|
||||
|
||||
<h2 id="trap-them-and-kill-them"><code class="language-plaintext highlighter-rouge">trap</code> them and <code class="language-plaintext highlighter-rouge">kill</code> them!</h2>
|
||||
|
||||
<p>There is a beautiful command in Linux called <a href="https://man7.org/linux/man-pages/man1/trap.1p.html"><code class="language-plaintext highlighter-rouge">trap</code></a> which <em>trap</em>s signals and let you run specific commands when they invoked. There is also good ol’ <a href="https://man7.org/linux/man-pages/man1/kill.1.html"><code class="language-plaintext highlighter-rouge">kill</code></a> command which not only kills processes but allows you to specify a signal to send. By combining these two, you can run specific functions from your scripts any time!</p>
|
||||
|
||||
<h3 id="basic-example">Basic Example</h3>
|
||||
<p>Let’s start by creating something very simple and build up from there. Create a script with the following contents:</p>
|
||||
|
||||
<div class="language-bash highlighter-rouge"><div class="highlight"><pre class="highlight"><code><span class="c">#!/bin/bash</span>
|
||||
|
||||
<span class="nb">echo</span> <span class="s2">"My pid is </span><span class="nv">$$</span><span class="s2">. Send me SIGUSR1!"</span>
|
||||
|
||||
func<span class="o">()</span> <span class="o">{</span>
|
||||
<span class="nb">echo</span> <span class="s2">"Got SIGUSR1"</span>
|
||||
<span class="o">}</span>
|
||||
|
||||
<span class="c"># here we are telling that run 'func' when USR1 signal is </span>
|
||||
<span class="c"># received # you can run anything. Combine commands with ; etc.</span>
|
||||
<span class="nb">trap</span> <span class="s2">"func"</span> USR1
|
||||
|
||||
<span class="c"># The while loop is important here otherwise our script will exit</span>
|
||||
<span class="c"># before we manage to get a chance to send a signal.</span>
|
||||
<span class="nv">i</span><span class="o">=</span>1
|
||||
<span class="k">while </span><span class="nb">true</span> <span class="p">;</span> <span class="k">do
|
||||
</span><span class="nb">echo</span> <span class="s2">"waiting SIGUSR1"</span>
|
||||
<span class="nb">sleep </span>1
|
||||
<span class="k">done</span>
|
||||
</code></pre></div></div>
|
||||
<p>Now make it executable and run it:</p>
|
||||
<div class="language-bash highlighter-rouge"><div class="highlight"><pre class="highlight"><code>❯ <span class="nb">chmod</span> +x trap_example
|
||||
❯ ./trap_example
|
||||
My pid is 2811137. Send me SIGUSR1!
|
||||
waiting SIGUSR1
|
||||
waiting SIGUSR1
|
||||
waiting SIGUSR1
|
||||
waiting SIGUSR1
|
||||
waiting SIGUSR1
|
||||
</code></pre></div></div>
|
||||
|
||||
<p>Open another terminal and send your signal with <code class="language-plaintext highlighter-rouge">kill</code> to the specified pid.</p>
|
||||
<div class="language-bash highlighter-rouge"><div class="highlight"><pre class="highlight"><code>❯ <span class="nb">kill</span> <span class="nt">-s</span> USR1 2811137
|
||||
</code></pre></div></div>
|
||||
|
||||
<p>You should receive <code class="language-plaintext highlighter-rouge">"Got SIGUSR!"</code> from the other process. That’s it! Now, imagine you write whatever thing you want to execute in <code class="language-plaintext highlighter-rouge">func</code> and then you can simply <code class="language-plaintext highlighter-rouge">kill -s ...</code> anytime and as many times you want!</p>
|
||||
|
||||
<p>Let’s move the while loop into the <code class="language-plaintext highlighter-rouge">func</code> and add some variables so you can see how powerful this is.</p>
|
||||
<div class="language-bash highlighter-rouge"><div class="highlight"><pre class="highlight"><code><span class="c">#!/bin/bash</span>
|
||||
|
||||
<span class="nb">echo</span> <span class="s2">"My pid is </span><span class="nv">$$</span><span class="s2">. Send me SIGUSR1!"</span>
|
||||
|
||||
func<span class="o">()</span> <span class="o">{</span>
|
||||
<span class="nv">i</span><span class="o">=</span>1
|
||||
<span class="k">while </span><span class="nb">true</span> <span class="p">;</span> <span class="k">do
|
||||
</span><span class="nb">echo</span> <span class="s2">"i: </span><span class="nv">$i</span><span class="s2">"</span>
|
||||
<span class="nv">i</span><span class="o">=</span><span class="k">$((</span> i <span class="o">+</span> <span class="m">1</span> <span class="k">))</span>
|
||||
<span class="nb">sleep </span>1
|
||||
<span class="k">done</span>
|
||||
<span class="o">}</span>
|
||||
|
||||
<span class="nb">trap</span> <span class="s2">"echo 'Got SIGUSR1!'; func"</span> USR1
|
||||
|
||||
<span class="c"># we need to call the function once, otherwise script</span>
|
||||
<span class="c"># will exit before we manage to send a signal</span>
|
||||
func
|
||||
|
||||
</code></pre></div></div>
|
||||
|
||||
<p>Now run the script and send <code class="language-plaintext highlighter-rouge">SIGUSR1</code>. Here is the result:</p>
|
||||
<div class="language-bash highlighter-rouge"><div class="highlight"><pre class="highlight"><code>❯ ./trap_example
|
||||
My pid is 2880704. Send me SIGUSR1!
|
||||
i: 1
|
||||
i: 2
|
||||
i: 3
|
||||
i: 4
|
||||
i: 5
|
||||
i: 6
|
||||
i: 7
|
||||
Got SIGUSR1!
|
||||
i: 1
|
||||
i: 2
|
||||
i: 3
|
||||
i: 4
|
||||
i: 5
|
||||
Got SIGUSR1!
|
||||
i: 1
|
||||
i: 2
|
||||
^C
|
||||
</code></pre></div></div>
|
||||
|
||||
<p>Isn’t this neat?</p>
|
||||
|
||||
<h3 id="more-useful-example">More useful example</h3>
|
||||
|
||||
<p>Let’s imagine you have multiple long running (infinite loops basically) scripts and you want to restart them without manually searching for their pid’s and killing them. <code class="language-plaintext highlighter-rouge">trap</code> is for the rescue, again! <sup><a href="##" title="Yeah, I know you can run a systemd service if you want but I think it is an overkill for this situation. Plus, I don't like dealing with them.">*</a></sup> This command is awesome.</p>
|
||||
|
||||
<p>Without further ado, let’s get started. Create a script called <code class="language-plaintext highlighter-rouge">script1</code> with the following contents:</p>
|
||||
|
||||
<div class="language-bash highlighter-rouge"><div class="highlight"><pre class="highlight"><code><span class="c">#!/bin/bash</span>
|
||||
<span class="c"># file: script1</span>
|
||||
|
||||
<span class="nv">i</span><span class="o">=</span>1
|
||||
<span class="k">while </span><span class="nb">true</span> <span class="p">;</span> <span class="k">do
|
||||
</span><span class="nb">echo</span> <span class="s2">"Hello from </span><span class="nv">$0</span><span class="s2">. i is </span><span class="nv">$i</span><span class="s2">"</span>
|
||||
<span class="nv">i</span><span class="o">=</span><span class="k">$((</span> i <span class="o">+</span> <span class="m">1</span> <span class="k">))</span>
|
||||
<span class="nb">sleep </span>1
|
||||
<span class="k">done</span>
|
||||
</code></pre></div></div>
|
||||
|
||||
<p>And symlink it to another name just for fun:</p>
|
||||
<div class="language-bash highlighter-rouge"><div class="highlight"><pre class="highlight"><code>❯ <span class="nb">chmod</span> +x script1
|
||||
❯ <span class="nb">ln</span> <span class="nt">-s</span> script1 script2
|
||||
</code></pre></div></div>
|
||||
|
||||
<p>Now we can pretend they are two different scripts as their outputs differ:</p>
|
||||
<div class="language-bash highlighter-rouge"><div class="highlight"><pre class="highlight"><code>❯ ./script1
|
||||
Hello from ./script1. i is 1
|
||||
Hello from ./script1. i is 2
|
||||
Hello from ./script1. i is 3
|
||||
Hello from ./script1. i is 4
|
||||
^C
|
||||
❯ ./script2
|
||||
Hello from ./script2. i is 1
|
||||
Hello from ./script2. i is 2
|
||||
Hello from ./script2. i is 3
|
||||
^C
|
||||
</code></pre></div></div>
|
||||
|
||||
<p>Finally, create the main script which will start child scripts and restart them on our signals:</p>
|
||||
|
||||
<div class="language-bash highlighter-rouge"><div class="highlight"><pre class="highlight"><code><span class="c">#!/bin/bash</span>
|
||||
<span class="nb">echo</span> <span class="s2">"My pid is </span><span class="nv">$$</span><span class="s2">. You know what to do ( ͡° ͜ʖ ͡°)"</span>
|
||||
<span class="nb">echo</span> <span class="s2">"You can also send me signal with 'killall </span><span class="sb">`</span><span class="nb">basename</span> <span class="nv">$0</span><span class="sb">`</span><span class="s2"> ...'"</span>
|
||||
|
||||
<span class="nv">pids</span><span class="o">=()</span> <span class="c"># we will store the pid's of child scripts here</span>
|
||||
<span class="nv">scripts_to_be_executed</span><span class="o">=(</span><span class="s2">"./script1"</span> <span class="s2">"./script2"</span><span class="o">)</span>
|
||||
|
||||
kill_childs<span class="o">(){</span> <span class="c"># wow, this sounded wild</span>
|
||||
<span class="k">for </span>pid <span class="k">in</span> <span class="s2">"</span><span class="k">${</span><span class="nv">pids</span><span class="p">[@]</span><span class="k">}</span><span class="s2">"</span>
|
||||
<span class="k">do
|
||||
</span><span class="nb">echo </span>killing <span class="s2">"</span><span class="nv">$pid</span><span class="s2">"</span>
|
||||
<span class="nb">kill</span> <span class="s2">"</span><span class="nv">$pid</span><span class="s2">"</span>
|
||||
<span class="k">done
|
||||
</span><span class="nv">pids</span><span class="o">=()</span>
|
||||
<span class="o">}</span>
|
||||
|
||||
<span class="c"># kill childs and restart all the scripts</span>
|
||||
restart_scripts<span class="o">(){</span>
|
||||
kill_childs
|
||||
<span class="c"># for each script in the list</span>
|
||||
<span class="k">for </span>script <span class="k">in</span> <span class="s2">"</span><span class="k">${</span><span class="nv">scripts_to_be_executed</span><span class="p">[@]</span><span class="k">}</span><span class="s2">"</span>
|
||||
<span class="k">do</span>
|
||||
<span class="c"># run the script and store its pid.</span>
|
||||
<span class="c"># '&' at the end of command is important otherwise</span>
|
||||
<span class="c"># the script will block until its execution is finished.</span>
|
||||
<span class="nv">$script</span> &
|
||||
<span class="nv">pid</span><span class="o">=</span><span class="nv">$!</span>
|
||||
pids+<span class="o">=(</span><span class="s2">"</span><span class="nv">$pid</span><span class="s2">"</span><span class="o">)</span>
|
||||
<span class="k">done</span>
|
||||
<span class="o">}</span>
|
||||
|
||||
<span class="c"># we will restart_scripts with SIGUSR1 signal</span>
|
||||
<span class="nb">trap</span> <span class="s1">'echo "restarting scripts"; restart_scripts'</span> USR1
|
||||
|
||||
<span class="c"># we will kill all the childs and exit the main script with SIGINT</span>
|
||||
<span class="c"># which is same signal as when you press <Control-C> on your terminal</span>
|
||||
<span class="nb">trap</span> <span class="s1">'echo exiting; kill_childs; exit'</span> INT
|
||||
|
||||
<span class="c"># run the function once</span>
|
||||
restart_scripts
|
||||
|
||||
<span class="c"># infinite loop, otherwise main script will exit before we send signal.</span>
|
||||
<span class="c"># remember, we started child processes with '&' so they won't block this script</span>
|
||||
<span class="k">while </span><span class="nb">true</span><span class="p">;</span> <span class="k">do
|
||||
</span><span class="nb">sleep </span>1
|
||||
<span class="k">done</span>
|
||||
</code></pre></div></div>
|
||||
|
||||
<p>Now, you can run your main script and reload your child scripts any time with <code class="language-plaintext highlighter-rouge">killall main_script -USR1</code></p>
|
||||
|
||||
<p>Here is an example run:</p>
|
||||
<div class="language-plaintext highlighter-rouge"><div class="highlight"><pre class="highlight"><code>❯ ./trap_multiple
|
||||
My pid is 3124123. You know what to do ( ͡° ͜ʖ ͡°)
|
||||
You can also send me signal with 'killall trap_multiple ...'
|
||||
Hello from ./script1. i is 1
|
||||
Hello from ./script2. i is 1
|
||||
Hello from ./script2. i is 2
|
||||
Hello from ./script1. i is 2
|
||||
Hello from ./script2. i is 3
|
||||
Hello from ./script1. i is 3
|
||||
restarting scripts
|
||||
killing 3124125
|
||||
killing 3124126
|
||||
Hello from ./script1. i is 1
|
||||
Hello from ./script2. i is 1
|
||||
Hello from ./script2. i is 2
|
||||
Hello from ./script1. i is 2
|
||||
Hello from ./script2. i is 3
|
||||
Hello from ./script1. i is 3
|
||||
Hello from ./script2. i is 4
|
||||
Hello from ./script1. i is 4
|
||||
restarting scripts
|
||||
killing 3124304
|
||||
killing 3124305
|
||||
Hello from ./script1. i is 1
|
||||
Hello from ./script2. i is 1
|
||||
Hello from ./script1. i is 2
|
||||
Hello from ./script2. i is 2
|
||||
^Cexiting
|
||||
killing 3124875
|
||||
killing 3124876
|
||||
</code></pre></div></div>
|
||||
|
||||
<h3 id="final-words">Final words</h3>
|
||||
<p>I think I am started to getting obsessed with <code class="language-plaintext highlighter-rouge">trap</code> command because it has such a good name. FOSS folks are at something when it comes to naming. Here is another good one:</p>
|
||||
|
||||
<blockquote>
|
||||
<p>- How can you see the contents of a file? <br />
|
||||
+ You <em><code class="language-plaintext highlighter-rouge">cat</code></em> it. <br />
|
||||
- What if you want to see them in reverse order? <br />
|
||||
+ You <em><code class="language-plaintext highlighter-rouge">tac</code></em> it. <br /></p>
|
||||
</blockquote>
|
||||
|
||||
<p>No, it is not just a joke. Try it… Man I love Gnoo slash Linux.</p>
|
||||
|
||||
<p>Anyway, I hope now you know how to <code class="language-plaintext highlighter-rouge">trap</code> and <code class="language-plaintext highlighter-rouge">kill</code>. Next week I will explain how to <code class="language-plaintext highlighter-rouge">unzip; strip; touch; finger; grep; mount; fsck; more; yes; fsck; fsck; umount; clean; sleep</code> <nobr>(° ͜ʖ ͡°)</nobr>. <sup><a href="##" title="jk :D">*</a></sup></p>
|
||||
|
||||
|
||||
</section>
|
||||
|
||||
<footer class="page__meta">
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
<p class="page__date"><strong><i class="fas fa-fw fa-calendar-alt" aria-hidden="true"></i> Updated:</strong> <time datetime="2023-01-15T21:48:08+00:00">January 15, 2023</time></p>
|
||||
|
||||
|
||||
</footer>
|
||||
|
||||
<section class="page__share">
|
||||
|
||||
|
||||
<a href="https://twitter.com/intent/tweet?text=Hot-Reload+Long+Running+Shell+Scripts+%28feat.+trap+%2F+kill%29%20https%3A%2F%2Fsahinakkaya.dev%2F2023%2F01%2F15%2Fhot-reloading-with-trap-and-kill.html" class="btn btn--twitter" onclick="window.open(this.href, 'window', 'left=20,top=20,width=500,height=500,toolbar=1,resizable=0'); return false;" title="Share on Twitter"><i class="fab fa-fw fa-twitter" aria-hidden="true"></i><span> Twitter</span></a>
|
||||
|
||||
<a href="https://www.facebook.com/sharer/sharer.php?u=https%3A%2F%2Fsahinakkaya.dev%2F2023%2F01%2F15%2Fhot-reloading-with-trap-and-kill.html" class="btn btn--facebook" onclick="window.open(this.href, 'window', 'left=20,top=20,width=500,height=500,toolbar=1,resizable=0'); return false;" title="Share on Facebook"><i class="fab fa-fw fa-facebook" aria-hidden="true"></i><span> Facebook</span></a>
|
||||
|
||||
<a href="https://www.linkedin.com/shareArticle?mini=true&url=https%3A%2F%2Fsahinakkaya.dev%2F2023%2F01%2F15%2Fhot-reloading-with-trap-and-kill.html" class="btn btn--linkedin" onclick="window.open(this.href, 'window', 'left=20,top=20,width=500,height=500,toolbar=1,resizable=0'); return false;" title="Share on LinkedIn"><i class="fab fa-fw fa-linkedin" aria-hidden="true"></i><span> LinkedIn</span></a>
|
||||
</section>
|
||||
|
||||
|
||||
|
||||
<nav class="pagination">
|
||||
|
||||
<a href="/2022/12/29/recap-of-2022.html" class="pagination--pager" title="Recap of 2022
|
||||
">Previous</a>
|
||||
|
||||
|
||||
<a href="#" class="pagination--pager disabled">Next</a>
|
||||
|
||||
</nav>
|
||||
|
||||
</div>
|
||||
|
||||
|
||||
</article>
|
||||
|
||||
|
||||
|
||||
<div class="page__related">
|
||||
<h4 class="page__related-title">You May Also Enjoy</h4>
|
||||
<div class="grid__wrapper">
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
<div class="grid__item">
|
||||
<article class="archive__item" itemscope itemtype="https://schema.org/CreativeWork">
|
||||
|
||||
<h2 class="archive__item-title no_toc" itemprop="headline">
|
||||
|
||||
<a href="/2022/12/29/recap-of-2022.html" rel="permalink">Recap of 2022
|
||||
</a>
|
||||
|
||||
</h2>
|
||||
|
||||
|
||||
<p class="page__meta">
|
||||
|
||||
|
||||
<span class="page__meta-date">
|
||||
<i class="far fa-fw fa-calendar-alt" aria-hidden="true"></i>
|
||||
|
||||
<time datetime="2022-12-29T20:22:08+00:00">December 29, 2022</time>
|
||||
</span>
|
||||
|
||||
|
||||
<span class="page__meta-sep"></span>
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
<span class="page__meta-readtime">
|
||||
<i class="far fa-fw fa-clock" aria-hidden="true"></i>
|
||||
|
||||
1 minute read
|
||||
|
||||
</span>
|
||||
|
||||
</p>
|
||||
|
||||
|
||||
<p class="archive__item-excerpt" itemprop="description">It’s been a while… It has been so long that I forgot how I was writing my blogs back then. My life didn’t change that much. Actually, it is getting worse.
|
||||
</p>
|
||||
</article>
|
||||
</div>
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
<div class="grid__item">
|
||||
<article class="archive__item" itemscope itemtype="https://schema.org/CreativeWork">
|
||||
|
||||
<h2 class="archive__item-title no_toc" itemprop="headline">
|
||||
|
||||
<a href="/2022/06/22/rant-on-peoples-reaction-to-copilot.html" rel="permalink">Rant: Stop whatever you are doing and learn how licenses work
|
||||
</a>
|
||||
|
||||
</h2>
|
||||
|
||||
|
||||
<p class="page__meta">
|
||||
|
||||
|
||||
<span class="page__meta-date">
|
||||
<i class="far fa-fw fa-calendar-alt" aria-hidden="true"></i>
|
||||
|
||||
<time datetime="2022-06-22T07:46:00+00:00">June 22, 2022</time>
|
||||
</span>
|
||||
|
||||
|
||||
<span class="page__meta-sep"></span>
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
<span class="page__meta-readtime">
|
||||
<i class="far fa-fw fa-clock" aria-hidden="true"></i>
|
||||
|
||||
2 minute read
|
||||
|
||||
</span>
|
||||
|
||||
</p>
|
||||
|
||||
|
||||
<p class="archive__item-excerpt" itemprop="description">Recently, Github announced
|
||||
that they are making Github Copilot available for everyone. Previously, it was in Beta and you could get it through the waiting l...</p>
|
||||
</article>
|
||||
</div>
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
<div class="grid__item">
|
||||
<article class="archive__item" itemscope itemtype="https://schema.org/CreativeWork">
|
||||
|
||||
<h2 class="archive__item-title no_toc" itemprop="headline">
|
||||
|
||||
<a href="/2022/04/08/confession-time.html" rel="permalink">Confession Time
|
||||
</a>
|
||||
|
||||
</h2>
|
||||
|
||||
|
||||
<p class="page__meta">
|
||||
|
||||
|
||||
<span class="page__meta-date">
|
||||
<i class="far fa-fw fa-calendar-alt" aria-hidden="true"></i>
|
||||
|
||||
<time datetime="2022-04-08T15:46:00+00:00">April 8, 2022</time>
|
||||
</span>
|
||||
|
||||
|
||||
<span class="page__meta-sep"></span>
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
<span class="page__meta-readtime">
|
||||
<i class="far fa-fw fa-clock" aria-hidden="true"></i>
|
||||
|
||||
2 minute read
|
||||
|
||||
</span>
|
||||
|
||||
</p>
|
||||
|
||||
|
||||
<p class="archive__item-excerpt" itemprop="description">A failure story
|
||||
Last week, I received an email from Let’s Encrypt reminding me to renew my certificates. I forgot to renew it and the certificate expired. No...</p>
|
||||
</article>
|
||||
</div>
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
<div class="grid__item">
|
||||
<article class="archive__item" itemscope itemtype="https://schema.org/CreativeWork">
|
||||
|
||||
<h2 class="archive__item-title no_toc" itemprop="headline">
|
||||
|
||||
<a href="/2022/03/03/never-get-trapped-in-grub-rescue-again.html" rel="permalink">Never Get Trapped in Grub Rescue Again!
|
||||
</a>
|
||||
|
||||
</h2>
|
||||
|
||||
|
||||
<p class="page__meta">
|
||||
|
||||
|
||||
<span class="page__meta-date">
|
||||
<i class="far fa-fw fa-calendar-alt" aria-hidden="true"></i>
|
||||
|
||||
<time datetime="2022-03-03T00:46:00+00:00">March 3, 2022</time>
|
||||
</span>
|
||||
|
||||
|
||||
<span class="page__meta-sep"></span>
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
<span class="page__meta-readtime">
|
||||
<i class="far fa-fw fa-clock" aria-hidden="true"></i>
|
||||
|
||||
4 minute read
|
||||
|
||||
</span>
|
||||
|
||||
</p>
|
||||
|
||||
|
||||
<p class="archive__item-excerpt" itemprop="description">Anytime I install a new system on my machine, I pray God for nothing bad happens. But it usually happens. When I reboot, I find myself in the “Grub rescue” m...</p>
|
||||
</article>
|
||||
</div>
|
||||
|
||||
|
||||
</div>
|
||||
</div>
|
||||
|
||||
|
||||
</div>
|
||||
|
||||
</div>
|
||||
|
||||
|
||||
<div class="search-content">
|
||||
<div class="search-content__inner-wrap"><form class="search-content__form" onkeydown="return event.key != 'Enter';">
|
||||
<label class="sr-only" for="search">
|
||||
Enter your search term...
|
||||
</label>
|
||||
<input type="search" id="search" class="search-input" tabindex="-1" placeholder="Enter your search term..." />
|
||||
</form>
|
||||
<div id="results" class="results"></div></div>
|
||||
|
||||
</div>
|
||||
|
||||
|
||||
<div id="footer" class="page__footer">
|
||||
<footer>
|
||||
<!-- start custom footer snippets -->
|
||||
|
||||
<!-- end custom footer snippets -->
|
||||
<div class="page__footer-follow">
|
||||
<ul class="social-icons">
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
<li><a href="/feed.xml"><i class="fas fa-fw fa-rss-square" aria-hidden="true"></i> Feed</a></li>
|
||||
|
||||
</ul>
|
||||
</div>
|
||||
|
||||
<div class="page__footer-copyright">© 2023 Şahin Akkaya's Personal Page. Powered by <a href="https://jekyllrb.com" rel="nofollow">Jekyll</a> & <a href="https://mademistakes.com/work/minimal-mistakes-jekyll-theme/" rel="nofollow">Minimal Mistakes</a>.</div>
|
||||
<div class="page__footer-copyright">
|
||||
Check out the <a href="https://github.com/Asocia/sahinakkayadotdev">code</a> of this site.
|
||||
</div>
|
||||
|
||||
</footer>
|
||||
</div>
|
||||
|
||||
|
||||
<script src="/assets/js/main.min.js"></script>
|
||||
|
||||
|
||||
|
||||
|
||||
<script src="/assets/js/lunr/lunr.min.js"></script>
|
||||
<script src="/assets/js/lunr/lunr-store.js"></script>
|
||||
<script src="/assets/js/lunr/lunr-en.js"></script>
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
</body>
|
||||
</html>
|
2
404.html
2
404.html
@ -190,7 +190,7 @@
|
||||
</ul>
|
||||
</div>
|
||||
|
||||
<div class="page__footer-copyright">© 2022 Şahin Akkaya's Personal Page. Powered by <a href="https://jekyllrb.com" rel="nofollow">Jekyll</a> & <a href="https://mademistakes.com/work/minimal-mistakes-jekyll-theme/" rel="nofollow">Minimal Mistakes</a>.</div>
|
||||
<div class="page__footer-copyright">© 2023 Şahin Akkaya's Personal Page. Powered by <a href="https://jekyllrb.com" rel="nofollow">Jekyll</a> & <a href="https://mademistakes.com/work/minimal-mistakes-jekyll-theme/" rel="nofollow">Minimal Mistakes</a>.</div>
|
||||
<div class="page__footer-copyright">
|
||||
Check out the <a href="https://github.com/Asocia/sahinakkayadotdev">code</a> of this site.
|
||||
</div>
|
||||
|
@ -369,7 +369,7 @@ me.</li>
|
||||
</ul>
|
||||
</div>
|
||||
|
||||
<div class="page__footer-copyright">© 2022 Şahin Akkaya's Personal Page. Powered by <a href="https://jekyllrb.com" rel="nofollow">Jekyll</a> & <a href="https://mademistakes.com/work/minimal-mistakes-jekyll-theme/" rel="nofollow">Minimal Mistakes</a>.</div>
|
||||
<div class="page__footer-copyright">© 2023 Şahin Akkaya's Personal Page. Powered by <a href="https://jekyllrb.com" rel="nofollow">Jekyll</a> & <a href="https://mademistakes.com/work/minimal-mistakes-jekyll-theme/" rel="nofollow">Minimal Mistakes</a>.</div>
|
||||
<div class="page__footer-copyright">
|
||||
Check out the <a href="https://github.com/Asocia/sahinakkayadotdev">code</a> of this site.
|
||||
</div>
|
||||
|
@ -58,4 +58,10 @@ var store = [{
|
||||
"tags": [],
|
||||
"url": "/2022/12/29/recap-of-2022.html",
|
||||
"teaser": null
|
||||
},{
|
||||
"title": "Hot-Reload Long Running Shell Scripts (feat. trap / kill)",
|
||||
"excerpt":"trap them and kill them! There is a beautiful command in Linux called trap which traps signals and let you run specific commands when they invoked. There is also good ol’ kill command which not only kills processes but allows you to specify a signal to send. By combining these...","categories": [],
|
||||
"tags": ["trap","kill","linux"],
|
||||
"url": "/2023/01/15/hot-reloading-with-trap-and-kill.html",
|
||||
"teaser": null
|
||||
}]
|
||||
|
@ -352,7 +352,7 @@
|
||||
</ul>
|
||||
</div>
|
||||
|
||||
<div class="page__footer-copyright">© 2022 Şahin Akkaya's Personal Page. Powered by <a href="https://jekyllrb.com" rel="nofollow">Jekyll</a> & <a href="https://mademistakes.com/work/minimal-mistakes-jekyll-theme/" rel="nofollow">Minimal Mistakes</a>.</div>
|
||||
<div class="page__footer-copyright">© 2023 Şahin Akkaya's Personal Page. Powered by <a href="https://jekyllrb.com" rel="nofollow">Jekyll</a> & <a href="https://mademistakes.com/work/minimal-mistakes-jekyll-theme/" rel="nofollow">Minimal Mistakes</a>.</div>
|
||||
<div class="page__footer-copyright">
|
||||
Check out the <a href="https://github.com/Asocia/sahinakkayadotdev">code</a> of this site.
|
||||
</div>
|
||||
|
260
feed.xml
260
feed.xml
@ -1,4 +1,227 @@
|
||||
<?xml version="1.0" encoding="utf-8"?><feed xmlns="http://www.w3.org/2005/Atom" ><generator uri="https://jekyllrb.com/" version="4.2.1">Jekyll</generator><link href="https://sahinakkaya.dev/feed.xml" rel="self" type="application/atom+xml" /><link href="https://sahinakkaya.dev/" rel="alternate" type="text/html" /><updated>2022-12-29T22:25:48+00:00</updated><id>https://sahinakkaya.dev/feed.xml</id><title type="html">Şahin Akkaya’s Personal Page</title><subtitle>Şahin Akkaya's personal blog - a perfectionist who likes to tinker everything until it is just right. Get ready to find some sweet tips that will boost your productivity and make you fall in love with your computer.</subtitle><author><name>Şahin Akkaya</name></author><entry><title type="html">Recap of 2022</title><link href="https://sahinakkaya.dev/2022/12/29/recap-of-2022.html" rel="alternate" type="text/html" title="Recap of 2022" /><published>2022-12-29T20:22:08+00:00</published><updated>2022-12-29T20:22:08+00:00</updated><id>https://sahinakkaya.dev/2022/12/29/recap-of-2022</id><content type="html" xml:base="https://sahinakkaya.dev/2022/12/29/recap-of-2022.html"><p>It’s been a while… It has been so long that I forgot how I was writing my blogs back then. My life didn’t change that much. Actually, it is getting worse.</p>
|
||||
<?xml version="1.0" encoding="utf-8"?><feed xmlns="http://www.w3.org/2005/Atom" ><generator uri="https://jekyllrb.com/" version="4.2.1">Jekyll</generator><link href="https://sahinakkaya.dev/feed.xml" rel="self" type="application/atom+xml" /><link href="https://sahinakkaya.dev/" rel="alternate" type="text/html" /><updated>2023-01-16T04:05:22+00:00</updated><id>https://sahinakkaya.dev/feed.xml</id><title type="html">Şahin Akkaya’s Personal Page</title><subtitle>Şahin Akkaya's personal blog - a perfectionist who likes to tinker everything until it is just right. Get ready to find some sweet tips that will boost your productivity and make you fall in love with your computer.</subtitle><author><name>Şahin Akkaya</name></author><entry><title type="html">Hot-Reload Long Running Shell Scripts (feat. trap / kill)</title><link href="https://sahinakkaya.dev/2023/01/15/hot-reloading-with-trap-and-kill.html" rel="alternate" type="text/html" title="Hot-Reload Long Running Shell Scripts (feat. trap / kill)" /><published>2023-01-15T21:48:08+00:00</published><updated>2023-01-15T21:48:08+00:00</updated><id>https://sahinakkaya.dev/2023/01/15/hot-reloading-with-trap-and-kill</id><content type="html" xml:base="https://sahinakkaya.dev/2023/01/15/hot-reloading-with-trap-and-kill.html"><h2 id="trap-them-and-kill-them"><code class="language-plaintext highlighter-rouge">trap</code> them and <code class="language-plaintext highlighter-rouge">kill</code> them!</h2>
|
||||
|
||||
<p>There is a beautiful command in Linux called <a href="https://man7.org/linux/man-pages/man1/trap.1p.html"><code class="language-plaintext highlighter-rouge">trap</code></a> which <em>trap</em>s signals and let you run specific commands when they invoked. There is also good ol’ <a href="https://man7.org/linux/man-pages/man1/kill.1.html"><code class="language-plaintext highlighter-rouge">kill</code></a> command which not only kills processes but allows you to specify a signal to send. By combining these two, you can run specific functions from your scripts any time!</p>
|
||||
|
||||
<h3 id="basic-example">Basic Example</h3>
|
||||
<p>Let’s start by creating something very simple and build up from there. Create a script with the following contents:</p>
|
||||
|
||||
<div class="language-bash highlighter-rouge"><div class="highlight"><pre class="highlight"><code><span class="c">#!/bin/bash</span>
|
||||
|
||||
<span class="nb">echo</span> <span class="s2">"My pid is </span><span class="nv">$$</span><span class="s2">. Send me SIGUSR1!"</span>
|
||||
|
||||
func<span class="o">()</span> <span class="o">{</span>
|
||||
<span class="nb">echo</span> <span class="s2">"Got SIGUSR1"</span>
|
||||
<span class="o">}</span>
|
||||
|
||||
<span class="c"># here we are telling that run 'func' when USR1 signal is </span>
|
||||
<span class="c"># received # you can run anything. Combine commands with ; etc.</span>
|
||||
<span class="nb">trap</span> <span class="s2">"func"</span> USR1
|
||||
|
||||
<span class="c"># The while loop is important here otherwise our script will exit</span>
|
||||
<span class="c"># before we manage to get a chance to send a signal.</span>
|
||||
<span class="nv">i</span><span class="o">=</span>1
|
||||
<span class="k">while </span><span class="nb">true</span> <span class="p">;</span> <span class="k">do
|
||||
</span><span class="nb">echo</span> <span class="s2">"waiting SIGUSR1"</span>
|
||||
<span class="nb">sleep </span>1
|
||||
<span class="k">done</span>
|
||||
</code></pre></div></div>
|
||||
<p>Now make it executable and run it:</p>
|
||||
<div class="language-bash highlighter-rouge"><div class="highlight"><pre class="highlight"><code>❯ <span class="nb">chmod</span> +x trap_example
|
||||
❯ ./trap_example
|
||||
My pid is 2811137. Send me SIGUSR1!
|
||||
waiting SIGUSR1
|
||||
waiting SIGUSR1
|
||||
waiting SIGUSR1
|
||||
waiting SIGUSR1
|
||||
waiting SIGUSR1
|
||||
</code></pre></div></div>
|
||||
|
||||
<p>Open another terminal and send your signal with <code class="language-plaintext highlighter-rouge">kill</code> to the specified pid.</p>
|
||||
<div class="language-bash highlighter-rouge"><div class="highlight"><pre class="highlight"><code>❯ <span class="nb">kill</span> <span class="nt">-s</span> USR1 2811137
|
||||
</code></pre></div></div>
|
||||
|
||||
<p>You should receive <code class="language-plaintext highlighter-rouge">"Got SIGUSR!"</code> from the other process. That’s it! Now, imagine you write whatever thing you want to execute in <code class="language-plaintext highlighter-rouge">func</code> and then you can simply <code class="language-plaintext highlighter-rouge">kill -s ...</code> anytime and as many times you want!</p>
|
||||
|
||||
<p>Let’s move the while loop into the <code class="language-plaintext highlighter-rouge">func</code> and add some variables so you can see how powerful this is.</p>
|
||||
<div class="language-bash highlighter-rouge"><div class="highlight"><pre class="highlight"><code><span class="c">#!/bin/bash</span>
|
||||
|
||||
<span class="nb">echo</span> <span class="s2">"My pid is </span><span class="nv">$$</span><span class="s2">. Send me SIGUSR1!"</span>
|
||||
|
||||
func<span class="o">()</span> <span class="o">{</span>
|
||||
<span class="nv">i</span><span class="o">=</span>1
|
||||
<span class="k">while </span><span class="nb">true</span> <span class="p">;</span> <span class="k">do
|
||||
</span><span class="nb">echo</span> <span class="s2">"i: </span><span class="nv">$i</span><span class="s2">"</span>
|
||||
<span class="nv">i</span><span class="o">=</span><span class="k">$((</span> i <span class="o">+</span> <span class="m">1</span> <span class="k">))</span>
|
||||
<span class="nb">sleep </span>1
|
||||
<span class="k">done</span>
|
||||
<span class="o">}</span>
|
||||
|
||||
<span class="nb">trap</span> <span class="s2">"echo 'Got SIGUSR1!'; func"</span> USR1
|
||||
|
||||
<span class="c"># we need to call the function once, otherwise script</span>
|
||||
<span class="c"># will exit before we manage to send a signal</span>
|
||||
func
|
||||
|
||||
</code></pre></div></div>
|
||||
|
||||
<p>Now run the script and send <code class="language-plaintext highlighter-rouge">SIGUSR1</code>. Here is the result:</p>
|
||||
<div class="language-bash highlighter-rouge"><div class="highlight"><pre class="highlight"><code>❯ ./trap_example
|
||||
My pid is 2880704. Send me SIGUSR1!
|
||||
i: 1
|
||||
i: 2
|
||||
i: 3
|
||||
i: 4
|
||||
i: 5
|
||||
i: 6
|
||||
i: 7
|
||||
Got SIGUSR1!
|
||||
i: 1
|
||||
i: 2
|
||||
i: 3
|
||||
i: 4
|
||||
i: 5
|
||||
Got SIGUSR1!
|
||||
i: 1
|
||||
i: 2
|
||||
^C
|
||||
</code></pre></div></div>
|
||||
|
||||
<p>Isn’t this neat?</p>
|
||||
|
||||
<h3 id="more-useful-example">More useful example</h3>
|
||||
|
||||
<p>Let’s imagine you have multiple long running (infinite loops basically) scripts and you want to restart them without manually searching for their pid’s and killing them. <code class="language-plaintext highlighter-rouge">trap</code> is for the rescue, again! <sup><a href="##" title="Yeah, I know you can run a systemd service if you want but I think it is an overkill for this situation. Plus, I don't like dealing with them.">*</a></sup> This command is awesome.</p>
|
||||
|
||||
<p>Without further ado, let’s get started. Create a script called <code class="language-plaintext highlighter-rouge">script1</code> with the following contents:</p>
|
||||
|
||||
<div class="language-bash highlighter-rouge"><div class="highlight"><pre class="highlight"><code><span class="c">#!/bin/bash</span>
|
||||
<span class="c"># file: script1</span>
|
||||
|
||||
<span class="nv">i</span><span class="o">=</span>1
|
||||
<span class="k">while </span><span class="nb">true</span> <span class="p">;</span> <span class="k">do
|
||||
</span><span class="nb">echo</span> <span class="s2">"Hello from </span><span class="nv">$0</span><span class="s2">. i is </span><span class="nv">$i</span><span class="s2">"</span>
|
||||
<span class="nv">i</span><span class="o">=</span><span class="k">$((</span> i <span class="o">+</span> <span class="m">1</span> <span class="k">))</span>
|
||||
<span class="nb">sleep </span>1
|
||||
<span class="k">done</span>
|
||||
</code></pre></div></div>
|
||||
|
||||
<p>And symlink it to another name just for fun:</p>
|
||||
<div class="language-bash highlighter-rouge"><div class="highlight"><pre class="highlight"><code>❯ <span class="nb">chmod</span> +x script1
|
||||
❯ <span class="nb">ln</span> <span class="nt">-s</span> script1 script2
|
||||
</code></pre></div></div>
|
||||
|
||||
<p>Now we can pretend they are two different scripts as their outputs differ:</p>
|
||||
<div class="language-bash highlighter-rouge"><div class="highlight"><pre class="highlight"><code>❯ ./script1
|
||||
Hello from ./script1. i is 1
|
||||
Hello from ./script1. i is 2
|
||||
Hello from ./script1. i is 3
|
||||
Hello from ./script1. i is 4
|
||||
^C
|
||||
❯ ./script2
|
||||
Hello from ./script2. i is 1
|
||||
Hello from ./script2. i is 2
|
||||
Hello from ./script2. i is 3
|
||||
^C
|
||||
</code></pre></div></div>
|
||||
|
||||
<p>Finally, create the main script which will start child scripts and restart them on our signals:</p>
|
||||
|
||||
<div class="language-bash highlighter-rouge"><div class="highlight"><pre class="highlight"><code><span class="c">#!/bin/bash</span>
|
||||
<span class="nb">echo</span> <span class="s2">"My pid is </span><span class="nv">$$</span><span class="s2">. You know what to do ( ͡° ͜ʖ ͡°)"</span>
|
||||
<span class="nb">echo</span> <span class="s2">"You can also send me signal with 'killall </span><span class="sb">`</span><span class="nb">basename</span> <span class="nv">$0</span><span class="sb">`</span><span class="s2"> ...'"</span>
|
||||
|
||||
<span class="nv">pids</span><span class="o">=()</span> <span class="c"># we will store the pid's of child scripts here</span>
|
||||
<span class="nv">scripts_to_be_executed</span><span class="o">=(</span><span class="s2">"./script1"</span> <span class="s2">"./script2"</span><span class="o">)</span>
|
||||
|
||||
kill_childs<span class="o">(){</span> <span class="c"># wow, this sounded wild</span>
|
||||
<span class="k">for </span>pid <span class="k">in</span> <span class="s2">"</span><span class="k">${</span><span class="nv">pids</span><span class="p">[@]</span><span class="k">}</span><span class="s2">"</span>
|
||||
<span class="k">do
|
||||
</span><span class="nb">echo </span>killing <span class="s2">"</span><span class="nv">$pid</span><span class="s2">"</span>
|
||||
<span class="nb">kill</span> <span class="s2">"</span><span class="nv">$pid</span><span class="s2">"</span>
|
||||
<span class="k">done
|
||||
</span><span class="nv">pids</span><span class="o">=()</span>
|
||||
<span class="o">}</span>
|
||||
|
||||
<span class="c"># kill childs and restart all the scripts</span>
|
||||
restart_scripts<span class="o">(){</span>
|
||||
kill_childs
|
||||
<span class="c"># for each script in the list</span>
|
||||
<span class="k">for </span>script <span class="k">in</span> <span class="s2">"</span><span class="k">${</span><span class="nv">scripts_to_be_executed</span><span class="p">[@]</span><span class="k">}</span><span class="s2">"</span>
|
||||
<span class="k">do</span>
|
||||
<span class="c"># run the script and store its pid.</span>
|
||||
<span class="c"># '&amp;' at the end of command is important otherwise</span>
|
||||
<span class="c"># the script will block until its execution is finished.</span>
|
||||
<span class="nv">$script</span> &amp;
|
||||
<span class="nv">pid</span><span class="o">=</span><span class="nv">$!</span>
|
||||
pids+<span class="o">=(</span><span class="s2">"</span><span class="nv">$pid</span><span class="s2">"</span><span class="o">)</span>
|
||||
<span class="k">done</span>
|
||||
<span class="o">}</span>
|
||||
|
||||
<span class="c"># we will restart_scripts with SIGUSR1 signal</span>
|
||||
<span class="nb">trap</span> <span class="s1">'echo "restarting scripts"; restart_scripts'</span> USR1
|
||||
|
||||
<span class="c"># we will kill all the childs and exit the main script with SIGINT</span>
|
||||
<span class="c"># which is same signal as when you press &lt;Control-C&gt; on your terminal</span>
|
||||
<span class="nb">trap</span> <span class="s1">'echo exiting; kill_childs; exit'</span> INT
|
||||
|
||||
<span class="c"># run the function once</span>
|
||||
restart_scripts
|
||||
|
||||
<span class="c"># infinite loop, otherwise main script will exit before we send signal.</span>
|
||||
<span class="c"># remember, we started child processes with '&amp;' so they won't block this script</span>
|
||||
<span class="k">while </span><span class="nb">true</span><span class="p">;</span> <span class="k">do
|
||||
</span><span class="nb">sleep </span>1
|
||||
<span class="k">done</span>
|
||||
</code></pre></div></div>
|
||||
|
||||
<p>Now, you can run your main script and reload your child scripts any time with <code class="language-plaintext highlighter-rouge">killall main_script -USR1</code></p>
|
||||
|
||||
<p>Here is an example run:</p>
|
||||
<div class="language-plaintext highlighter-rouge"><div class="highlight"><pre class="highlight"><code>❯ ./trap_multiple
|
||||
My pid is 3124123. You know what to do ( ͡° ͜ʖ ͡°)
|
||||
You can also send me signal with 'killall trap_multiple ...'
|
||||
Hello from ./script1. i is 1
|
||||
Hello from ./script2. i is 1
|
||||
Hello from ./script2. i is 2
|
||||
Hello from ./script1. i is 2
|
||||
Hello from ./script2. i is 3
|
||||
Hello from ./script1. i is 3
|
||||
restarting scripts
|
||||
killing 3124125
|
||||
killing 3124126
|
||||
Hello from ./script1. i is 1
|
||||
Hello from ./script2. i is 1
|
||||
Hello from ./script2. i is 2
|
||||
Hello from ./script1. i is 2
|
||||
Hello from ./script2. i is 3
|
||||
Hello from ./script1. i is 3
|
||||
Hello from ./script2. i is 4
|
||||
Hello from ./script1. i is 4
|
||||
restarting scripts
|
||||
killing 3124304
|
||||
killing 3124305
|
||||
Hello from ./script1. i is 1
|
||||
Hello from ./script2. i is 1
|
||||
Hello from ./script1. i is 2
|
||||
Hello from ./script2. i is 2
|
||||
^Cexiting
|
||||
killing 3124875
|
||||
killing 3124876
|
||||
</code></pre></div></div>
|
||||
|
||||
<h3 id="final-words">Final words</h3>
|
||||
<p>I think I am started to getting obsessed with <code class="language-plaintext highlighter-rouge">trap</code> command because it has such a good name. FOSS folks are at something when it comes to naming. Here is another good one:</p>
|
||||
|
||||
<blockquote>
|
||||
<p>- How can you see the contents of a file? <br />
|
||||
+ You <em><code class="language-plaintext highlighter-rouge">cat</code></em> it. <br />
|
||||
- What if you want to see them in reverse order? <br />
|
||||
+ You <em><code class="language-plaintext highlighter-rouge">tac</code></em> it. <br /></p>
|
||||
</blockquote>
|
||||
|
||||
<p>No, it is not just a joke. Try it… Man I love Gnoo slash Linux.</p>
|
||||
|
||||
<p>Anyway, I hope now you know how to <code class="language-plaintext highlighter-rouge">trap</code> and <code class="language-plaintext highlighter-rouge">kill</code>. Next week I will explain how to <code class="language-plaintext highlighter-rouge">unzip; strip; touch; finger; grep; mount; fsck; more; yes; fsck; fsck; umount; clean; sleep</code> <nobr>(° ͜ʖ ͡°)</nobr>. <sup><a href="##" title="jk :D">*</a></sup></p></content><author><name>Şahin Akkaya</name></author><category term="trap" /><category term="kill" /><category term="linux" /><summary type="html">trap them and kill them!</summary></entry><entry><title type="html">Recap of 2022</title><link href="https://sahinakkaya.dev/2022/12/29/recap-of-2022.html" rel="alternate" type="text/html" title="Recap of 2022" /><published>2022-12-29T20:22:08+00:00</published><updated>2022-12-29T20:22:08+00:00</updated><id>https://sahinakkaya.dev/2022/12/29/recap-of-2022</id><content type="html" xml:base="https://sahinakkaya.dev/2022/12/29/recap-of-2022.html"><p>It’s been a while… It has been so long that I forgot how I was writing my blogs back then. My life didn’t change that much. Actually, it is getting worse.</p>
|
||||
|
||||
<p>The biggest problem of my life is the graduation project. Oh, God it is making me sick! I simply don’t have any interest for the subject I am supposed to work on. One part of me saying that “come on, you came this far. You are nearly finished. One last push!” and other part of me saying “oh no, don’t do it. You have never done something you don’t like in your entire life. F*ck it!”. So I am wasting my time each term with the dilemma I just described. I really don’t know what to do. This thing is f’ed up.</p>
|
||||
|
||||
@ -462,37 +685,4 @@ util.lua: highlight<span class="o">(</span>group, prope
|
||||
<ul>
|
||||
<li>I figured that out only after using wild card in the second command. So I think it is does not feel natural.</li>
|
||||
<li>It is still not giving the same output. Try and see the difference! <a href="##" title="You will not be able to see which file contains which line. 'cat' will just concatenate all the input.">*</a></li>
|
||||
</ul></content><author><name>Şahin Akkaya</name></author><category term="cat" /><category term="grep" /><category term="linux" /><category term="command-line" /><summary type="html">cat some_file | grep some_pattern I’m sure that you run a command something like above at least once if you are using terminal. You know how cat and grep works and you also know what pipe (|) does. So you naturally combine all of these to make the job done. I was also doing it this way. What I didn’t know is that grep already accepts file as an argument. So the above command could be rewritten as: grep some_pattern some_file</summary></entry><entry><title type="html">First blog post</title><link href="https://sahinakkaya.dev/2021/12/24/first-blog-post.html" rel="alternate" type="text/html" title="First blog post" /><published>2021-12-24T23:54:08+00:00</published><updated>2021-12-24T23:54:08+00:00</updated><id>https://sahinakkaya.dev/2021/12/24/first-blog-post</id><content type="html" xml:base="https://sahinakkaya.dev/2021/12/24/first-blog-post.html"><style>
|
||||
.ab {
|
||||
font-size: 1.3em;
|
||||
line-height:0;
|
||||
top:0;
|
||||
}
|
||||
.cd {
|
||||
|
||||
text-decoration: none;
|
||||
}
|
||||
</style>
|
||||
|
||||
<p><em><code class="language-plaintext highlighter-rouge">Hello, World!</code></em><a href="##" title="I think I just wrote the best first sentence I could write as a programmer :D" class="cd"><sup class="ab">*</sup></a>
|
||||
So here I am and welcome to my first blog. Having a personal space on the Internet has been a dream for me for years and I am happy that it finally have come true. You might think that I could sign-up for a social media platform and my profile would be a personal space for me but no. I just don’t feel comfortable with that way. This has been the case since my childhood and also the reason why I don’t use Facebook, Instagram or any other social media. If you think you found me on these platforms, I would say it is not me. I might write another post about why I don’t like social media but I will cut this one here.</p>
|
||||
|
||||
<h2 id="why-i-wanted-to-start-blogging">Why I wanted to start blogging?</h2>
|
||||
<p>There are several reasons for starting my own site and blogging, but I can list the most important ones as follows:</p>
|
||||
|
||||
<h3 id="giving-back-to-community">Giving back to community</h3>
|
||||
<p>I use the software developed and brought by the community every day. The moment I power on my computer I start using Free Software. It really amazes me to see the work produced by people who do not know each other at all. For example, I did not even write a single line of code for this site. If Free Software didn’t exist, I’d either have to spend money and use a platform that I have limited control over, or waste my time and build a site with a possibly worse design than this one<a href="##" title="swh" class="cd"><sup class="ab">*</sup></a>. In return for this, I want to give back to the community. For me, the way to give back to the community so far has been to share the projects I’ve done and archive the things I learn every day in a repository called <a href="https://github.com/Asocia/til">TIL</a><a href="##" title="Today I Learned" class="cd"><sup class="ab">*</sup></a>. But some of the til’s I’ve written recently are getting lengthy and I think they deserve their own posts. So instead of writing long til’s, I will blog what I learned here.</p>
|
||||
|
||||
<h3 id="archiving-the-memories">Archiving the memories</h3>
|
||||
<p>I like to go over what I have done in the past once in a while. Blogging is perfect way to do this. I still read my diaries that I wrote in the past and they are fun. But I promise I will keep these posts more formal than my diaries<a href="##" title="swh" class="cd"><sup class="ab">*</sup></a>.</p>
|
||||
|
||||
<h3 id="pushing-myself-to-do-something-useful">Pushing myself to do something useful</h3>
|
||||
<p>At the end of every year, I sit on my desk and think about what I did in that year. I generally don’t like the result because I fail to keep some of my resolutions for that year. Setting up a personal website was one of my resolutions for 2021 and it looks like I manage to keep it<a href="##" title="hooray!" class="cd"><sup class="ab">*</sup></a><a href="##" title="swh" class="cd"><sup class="ab">*</sup></a>. Unfortunately, I can’t always keep my spirits up. Sometimes I just do nothing and all the time passes. Hopefully, the feeling that I have to write something will help me get out of bad mood at such times.</p>
|
||||
|
||||
<h3 id="improving-my-writing-skills">Improving my writing skills</h3>
|
||||
<p>Last but not least, I want to improve my writing. Even though I don’t use a formal language while writing here, I think it will help me improve my writing skills.</p>
|
||||
|
||||
<h2 id="final-words">Final words</h2>
|
||||
<p>While writing this post I already come up with some new topics to write but I think they need their own posts.</p>
|
||||
|
||||
<p>Subscribe to my <a href="/feed.xml"><i class="fas fa-fw fa-rss-square" aria-hidden="true"></i>RSS Feed</a> to not miss them. You know RSS, right? I recently started using it and it is the best way to consume content. Do yourself a favor and search it if you don’t know. I will probably write something about it in the following blog posts. That’s all from me and thank you for reading. See you next time!</p></content><author><name>Şahin Akkaya</name></author><summary type="html">Hello, World!* So here I am and welcome to my first blog. Having a personal space on the Internet has been a dream for me for years and I am happy that it fi...</summary></entry></feed>
|
||||
</ul></content><author><name>Şahin Akkaya</name></author><category term="cat" /><category term="grep" /><category term="linux" /><category term="command-line" /><summary type="html">cat some_file | grep some_pattern I’m sure that you run a command something like above at least once if you are using terminal. You know how cat and grep works and you also know what pipe (|) does. So you naturally combine all of these to make the job done. I was also doing it this way. What I didn’t know is that grep already accepts file as an argument. So the above command could be rewritten as: grep some_pattern some_file</summary></entry></feed>
|
49
index.html
49
index.html
@ -284,6 +284,53 @@
|
||||
|
||||
|
||||
|
||||
<div class="list__item">
|
||||
<article class="archive__item" itemscope itemtype="https://schema.org/CreativeWork">
|
||||
|
||||
<h2 class="archive__item-title no_toc" itemprop="headline">
|
||||
|
||||
<a href="/2023/01/15/hot-reloading-with-trap-and-kill.html" rel="permalink">Hot-Reload Long Running Shell Scripts (feat. trap / kill)
|
||||
</a>
|
||||
|
||||
</h2>
|
||||
|
||||
|
||||
<p class="page__meta">
|
||||
|
||||
|
||||
<span class="page__meta-date">
|
||||
<i class="far fa-calendar-alt" aria-hidden="true"></i>
|
||||
|
||||
<time datetime="2023-01-15T21:48:08+00:00">January 15, 2023</time>
|
||||
</span>
|
||||
|
||||
|
||||
<span class="page__meta-sep"></span>
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
<span class="page__meta-readtime">
|
||||
<i class="far fa-clock" aria-hidden="true"></i>
|
||||
|
||||
5 minute read
|
||||
|
||||
</span>
|
||||
|
||||
</p>
|
||||
|
||||
|
||||
<p class="archive__item-excerpt" itemprop="description">trap them and kill them!
|
||||
</p>
|
||||
</article>
|
||||
</div>
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
<div class="list__item">
|
||||
<article class="archive__item" itemscope itemtype="https://schema.org/CreativeWork">
|
||||
|
||||
@ -788,7 +835,7 @@ I’m sure that you run a command something like above at least once if you are
|
||||
</ul>
|
||||
</div>
|
||||
|
||||
<div class="page__footer-copyright">© 2022 Şahin Akkaya's Personal Page. Powered by <a href="https://jekyllrb.com" rel="nofollow">Jekyll</a> & <a href="https://mademistakes.com/work/minimal-mistakes-jekyll-theme/" rel="nofollow">Minimal Mistakes</a>.</div>
|
||||
<div class="page__footer-copyright">© 2023 Şahin Akkaya's Personal Page. Powered by <a href="https://jekyllrb.com" rel="nofollow">Jekyll</a> & <a href="https://mademistakes.com/work/minimal-mistakes-jekyll-theme/" rel="nofollow">Minimal Mistakes</a>.</div>
|
||||
<div class="page__footer-copyright">
|
||||
Check out the <a href="https://github.com/Asocia/sahinakkayadotdev">code</a> of this site.
|
||||
</div>
|
||||
|
@ -41,6 +41,10 @@
|
||||
<lastmod>2022-12-29T20:22:08+00:00</lastmod>
|
||||
</url>
|
||||
<url>
|
||||
<loc>https://sahinakkaya.dev/2023/01/15/hot-reloading-with-trap-and-kill.html</loc>
|
||||
<lastmod>2023-01-15T21:48:08+00:00</lastmod>
|
||||
</url>
|
||||
<url>
|
||||
<loc>https://sahinakkaya.dev/about/</loc>
|
||||
</url>
|
||||
<url>
|
||||
@ -51,6 +55,6 @@
|
||||
</url>
|
||||
<url>
|
||||
<loc>https://sahinakkaya.dev/assets/docs/resume.pdf</loc>
|
||||
<lastmod>2022-12-29T22:25:41+00:00</lastmod>
|
||||
<lastmod>2023-01-16T04:00:03+00:00</lastmod>
|
||||
</url>
|
||||
</urlset>
|
||||
|
Loading…
Reference in New Issue
Block a user