<?xml version="1.0" encoding="UTF-8"?><rss xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:atom="http://www.w3.org/2005/Atom" version="2.0" xmlns:media="http://search.yahoo.com/mrss/"><channel><title><![CDATA[bash - All your code are belong to us]]></title><description><![CDATA[Thoughts, stories and ideas on code and technology in general.<br>Blog title inspired by <a href="https://en.wikipedia.org/wiki/All_your_base_are_belong_to_us" target="_blank">this meme</a>]]></description><link>https://allurcode.com/</link><image><url>https://allurcode.com/favicon.png</url><title>bash - All your code are belong to us</title><link>https://allurcode.com/</link></image><generator>Ghost 4.48</generator><lastBuildDate>Tue, 09 Jun 2026 08:52:13 GMT</lastBuildDate><atom:link href="https://allurcode.com/tag/bash/rss/" rel="self" type="application/rss+xml"/><ttl>60</ttl><item><title><![CDATA[Network-attached storage (NAS) on local network with Raspberry PI]]></title><description><![CDATA[<!--kg-card-begin: markdown--><p>Do you have a few old external USB drives lying around collecting dust? Well, you could put them to good use with a simple and robust NAS (Network-attached storage) using a Rasberry Pi.<br>
Moreover, if you have plenty of old travel photos on that external drive, you could host my</p>]]></description><link>https://allurcode.com/network-attached-storage-on-local-network-with-raspberry-pi/</link><guid isPermaLink="false">620007e960a53816cf31be37</guid><category><![CDATA[Raspberry Pi]]></category><category><![CDATA[bash]]></category><category><![CDATA[nas]]></category><category><![CDATA[usb]]></category><category><![CDATA[drive]]></category><category><![CDATA[Raspberry Pi OS]]></category><dc:creator><![CDATA[Wojtek]]></dc:creator><pubDate>Sun, 18 Sep 2022 16:03:20 GMT</pubDate><content:encoded><![CDATA[<!--kg-card-begin: markdown--><p>Do you have a few old external USB drives lying around collecting dust? Well, you could put them to good use with a simple and robust NAS (Network-attached storage) using a Rasberry Pi.<br>
Moreover, if you have plenty of old travel photos on that external drive, you could host my open source NodeJS app (<a href="https://github.com/SixBytesUnder/infoboard">GitHub repo here</a>) to display them on an old tablet, just like an interactive smart photo frame.</p>
<p>I&apos;ve tested this on Rasberry Pi 3 and 4, but really any should work. If your external USB drive has it&apos;s own power source, you can connect it to RPi directly, but if it doesn&apos;t have it&apos;s own power source, you might need an externally powered USB hub to which you&apos;ll connect your USB drives. Raspberry might not be able to suply enough current to power more than 2-3 external USB drives.</p>
<h2 id="prerequisites">Prerequisites</h2>
<p>I assume you already have Raspberry Pi OS installed, but if not, install it from official source <a href="https://www.raspberrypi.com/software/">https://www.raspberrypi.com/software/</a> (make sure you enable SSH during intallation).<br>
If you already have a different Linux distribution installed, this should also work, but you might need to slightly modify some of below commands.</p>
<ol>
<li>
<p>ssh to your RPi and update your system</p>
<pre><code class="language-bash">sudo apt update &amp;&amp; sudo apt full-upgrade
</code></pre>
</li>
<li>
<p>Connect any USB drives you want to make accessible over the network.<br>
Raspberry Pi OS should automatically detect USB drives when you plug them in. To see what drives it found run:</p>
<pre><code class="language-bash">sudo blkid

/dev/mmcblk0p1: LABEL_FATBOOT=&quot;boot&quot; LABEL=&quot;boot&quot; UUID=&quot;17B6-FC00&quot; BLOCK_SIZE=&quot;512&quot; TYPE=&quot;vfat&quot; PARTUUID=&quot;834cc527-01&quot;
/dev/mmcblk0p2: LABEL=&quot;rootfs&quot; UUID=&quot;b101bb80-3338-4b94-a775-b3844f8f2aa8&quot; BLOCK_SIZE=&quot;4096&quot; TYPE=&quot;ext4&quot; PARTUUID=&quot;834cc527-02&quot;
/dev/sdc1: LABEL=&quot;SAMSUNG&quot; BLOCK_SIZE=&quot;512&quot; UUID=&quot;8E84B2B084B29A63&quot; TYPE=&quot;ntfs&quot; PARTUUID=&quot;01022cb5-01&quot;
/dev/sdd1: LABEL=&quot;SAMSUNG&quot; BLOCK_SIZE=&quot;512&quot; UUID=&quot;1E904FEC904FC8CB&quot; TYPE=&quot;ntfs&quot; PARTUUID=&quot;d9d225e4-01&quot;
/dev/sdb1: LABEL=&quot;Elements&quot; BLOCK_SIZE=&quot;512&quot; UUID=&quot;DC74B02074AFFB80&quot; TYPE=&quot;ntfs&quot; PARTLABEL=&quot;Elements&quot; PARTUUID=&quot;ae55a0c1-17a6-41a5-bf6f-c4d86a960b7e&quot;
/dev/sda1: LABEL=&quot;SAMSUNG&quot; BLOCK_SIZE=&quot;512&quot; UUID=&quot;0C6EBE646EBE466C&quot; TYPE=&quot;ntfs&quot; PARTUUID=&quot;411e3984-01&quot;
</code></pre>
<p>or</p>
<pre><code class="language-bash">ls -l /dev/disk/by-uuid

lrwxrwxrwx 1 root root 10 Aug 11 20:28 0C6EBE646EBE466C -&gt; ../../sda1
lrwxrwxrwx 1 root root 15 Aug  9 22:07 17B6-FC00 -&gt; ../../mmcblk0p1
lrwxrwxrwx 1 root root 10 Aug  9 22:08 1E904FEC904FC8CB -&gt; ../../sdd1
lrwxrwxrwx 1 root root 10 Aug  9 22:08 8E84B2B084B29A63 -&gt; ../../sdc1
lrwxrwxrwx 1 root root 15 Aug  9 22:07 b101bb80-3338-4b94-a775-b3844f8f2aa8 -&gt; ../../mmcblk0p2
lrwxrwxrwx 1 root root 10 Aug 11 20:28 DC74B02074AFFB80 -&gt; ../../sdb1
</code></pre>
<p>for a bit more visual representation, try:</p>
<pre><code class="language-bash">lsblk

NAME        MAJ:MIN RM   SIZE RO TYPE MOUNTPOINT
sda           8:0    0   1.8T  0 disk
&#x2514;&#x2500;sda1        8:1    0   1.8T  0 part /media/pi/SAMSUNG2
sdb           8:16   0   3.6T  0 disk
&#x2514;&#x2500;sdb1        8:17   0   3.6T  0 part /media/pi/Elements
sdc           8:32   0 931.5G  0 disk
&#x2514;&#x2500;sdc1        8:33   0 931.5G  0 part /media/pi/SAMSUNG1
sdd           8:48   0 931.5G  0 disk
&#x2514;&#x2500;sdd1        8:49   0 931.5G  0 part /media/pi/SAMSUNG
mmcblk0     179:0    0  29.7G  0 disk
&#x251C;&#x2500;mmcblk0p1 179:1    0   256M  0 part /boot
&#x2514;&#x2500;mmcblk0p2 179:2    0  29.5G  0 part /
</code></pre>
<p>We&apos;re interested in <code>/dev/sda1</code>, <code>/dev/sdb1</code>, <code>/dev/sdc1</code> and <code>/dev/sdd1</code><br>
Make a note of UUID for each drive you want to use.</p>
</li>
<li>
<p>Create folders for each drive, where you&apos;ll see their contents</p>
<pre><code class="language-bash">sudo mkdir /mnt/nas1
sudo chown -R pi:pi /mnt/nas1
</code></pre>
<p>Repeat above for each drive, you&apos;re configuring.</p>
</li>
<li>
<p>Install missing dependiencies<br>
Make sure your system is able to read NTFS partisions by installing <a href="https://packages.debian.org/search?keywords=ntfs-3g">ntfs-3g package</a> It should already be there if you&apos;re using original Raspberry Pi OS. If not install it.</p>
<pre><code class="language-bash">sudo apt install ntfs-3g
</code></pre>
<p>You might need to also install Extended FAT package to read FAT partitions.</p>
<pre><code class="language-bash">sudo apt install exfat-fuse exfat-utils
</code></pre>
</li>
<li>
<p>Create a user that will access mounted drives<br>
I&apos;m creating a new user called &quot;nas&quot; for the purpose of accessing NAS resources over network.</p>
<pre><code class="language-bash">sudo useradd nas
sudo passwd nas

New password:
Retype new password:
passwd: password updated successfully
</code></pre>
<p>Find out new user&apos;s id and group id.</p>
<pre><code class="language-bash">id -u nas
id -g nas
</code></pre>
<p>In my case both returned &quot;1001&quot;.</p>
</li>
<li>
<p>Automatically mount drives<br>
Now that we have all the dependencies installed, we need to make sure our drives mount automatically after system restart.</p>
<pre><code class="language-bash">sudo vim.tiny /etc/fstab
</code></pre>
<p>which if unmodified, should look similar to this:</p>
<pre><code class="language-bash">proc            /proc           proc    defaults          0       0
PARTUUID=834cc527-01  /boot           vfat    defaults,flush    0       2
PARTUUID=834cc527-02  /               ext4    defaults,noatime  0       1
# a swapfile is not a swap partition, no line here
#   use  dphys-swapfile swap[on|off]  for that
</code></pre>
<p>Don&apos;t change any of that, just leave it as it is and add your entries below. Remember to change the values of <code>UUID</code>, <code>uid</code> and <code>gid</code> with the values we noted before.</p>
<pre><code class="language-bash"># Drive 1 - 2T
UUID=0C6EBE646EBE466C /mnt/nas1 auto nofail,uid=1001,gid=1001,noatime 0 0

# Drive 2 - 1T
UUID=1E904FEC904FC8CB /mnt/nas2 auto nofail,uid=1001,gid=1001,noatime 0 0

# Drive 3 - 1T
UUID=8E84B2B084B29A63 /mnt/nas3 auto nofail,uid=1001,gid=1001,noatime 0 0

# Drive 4 - 4T
UUID=DC74B02074AFFB80 /mnt/nas4 auto nofail,uid=1001,gid=1001,noatime 0 0
</code></pre>
<p>Your system might have automatically mounted all the drives or if you&apos;re debugging or changing something and you had your drive already mounted, you&apos;ll have to unmount it and mount it again for the changes to take effect.</p>
<pre><code class="language-bash">sudo umount /dev/sda1
sudo umount /dev/sdb1
sudo umount /dev/sdc1
sudo umount /dev/sdd1
</code></pre>
<p>Mount defined drives</p>
<pre><code class="language-bash">sudo mount -av

/proc                    : already mounted
/boot                    : already mounted
/                        : ignored
/mnt/nas1                : successfully mounted
/mnt/nas2                : successfully mounted
/mnt/nas3                : successfully mounted
/mnt/nas4                : successfully mounted
</code></pre>
<p>Now we have drives mounted that should persist over system restarts.</p>
</li>
</ol>
<h2 id="share-mounted-drives-on-local-network">Share mounted drives on local network</h2>
<ol>
<li>
<p>Install Samba<br>
Samba is a suite of applications that implements the Server Message Block (SMB) protocol. Many operating systems, including Microsoft Windows, use the SMB protocol for client-server networking. Samba enables Linux / Unix machines to communicate with Windows machines in a network, which in our case simply means sharing that mounted drive(s) over network.</p>
<pre><code class="language-bash">sudo apt install samba samba-common-bin cifs-utils
</code></pre>
</li>
<li>
<p>Create samba user<br>
Remember we created a new system user <code>nas</code>, now we need to make it a Samba user. The password we created before for that user was for RPi OS, now you can specify a different password to use when accessing your resources over network. You can keep passwords the same for ease of use.</p>
<pre><code class="language-bash">sudo smbpasswd -a nas
New SMB password:
Retype new SMB password:
Added user nas.
</code></pre>
<p>The <code>-a</code> switch adds user <code>nas</code> to the Samba password list.<br>
If you need to modify existing Samba user you can do it with:</p>
<pre><code class="language-bash">sudo smbpasswd nas
</code></pre>
<p>To list existing samba users run:</p>
<pre><code class="language-bash">sudo pdbedit -L -v
</code></pre>
</li>
<li>
<p>Configure network shareable resource<br>
Open Samba config file</p>
<pre><code class="language-bash">sudo vim.tiny /etc/samba/smb.conf
</code></pre>
<p>Go to the bottom of the file and add</p>
<pre><code class="language-bash">[nas1]
comment = My USB drive 2T
path = /mnt/nas1
# you can list multiple users here separated by space
valid users = nas
force group = users
create mask = 0660
directory mask = 0771
read only = no
# if you need unathenticated access (guest users), uncomment below line
# guest ok = yes
</code></pre>
<p>Add a section like this for each of your drives. Changing the group name <code>[nas1]</code> and <code>path</code> accordingly.<br>
Test if the config is correct</p>
<pre><code class="language-bash">testparm

Load smb config files from /etc/samba/smb.conf
Loaded services file OK.
Weak crypto is allowed
Server role: ROLE_STANDALONE
</code></pre>
<p>If everything is ok, restart Samba to apply new settings</p>
<pre><code class="language-bash">sudo systemctl restart smbd
</code></pre>
<p>In case of any issues or simply if you want to see active connections, run:</p>
<pre><code class="language-bash">sudo smbstatus
</code></pre>
</li>
</ol>
<h2 id="map-drive-on-windows">Map drive on Windows</h2>
<ol>
<li>Open file manager</li>
<li>Go to &quot;This PC&quot;</li>
<li>At the top in &quot;Computer&quot; tab, click on &quot;Map network drive&quot;, <strong>not</strong> the &quot;Add network location&quot;. There&apos;s a key difference.</li>
<li>Choose a Drive letter you want to assign to this resource.</li>
<li>In &quot;Folder&quot; field type in <code>\\RASPBERRYPI\nas1</code> or whatever location your Raspberry is at</li>
<li>Leave &quot;Reconnect at sign-in&quot; ticked.</li>
<li>Click Finish</li>
</ol>
<!--kg-card-end: markdown--><figure class="kg-card kg-image-card"><img src="https://allurcode.com/content/images/2022/09/windows-map-drive.png" class="kg-image" alt loading="lazy" width="840" height="713"></figure><!--kg-card-begin: markdown--><p>On the credentials popup, Windows will most likely prefil your current user details. If that&apos;s the case click &quot;More choices&quot; and then &quot;Use a different account&quot;. This will allow you to specify your Samba username and password. For us the user was <code>nas</code>.</p>
<h2 id="map-drive-on-linux">Map drive on Linux</h2>
<p>If you want to access local drives on Linux (or Mac) it should be very similar to what we&apos;ve done before.</p>
<pre><code class="language-bash">sudo apt install cifs-utils
sudo mkdir /mnt/nas1
sudo mkdir /mnt/nas2
sudo mkdir /mnt/nas3
sudo mkdir /mnt/nas4
sudo vim /etc/fstab
</code></pre>
<p>Add below lines to the bottom of <code>fstab</code> file</p>
<pre><code class="language-bash">//192.168.0.100/nas1  /mnt/nas1 cifs    uid=0,username=nas,password=******,iocharset=utf8,file_mode=0777,dir_mode=0777,sec=ntlmssp  0  0
//192.168.0.100/nas2  /mnt/nas2 cifs    uid=0,username=nas,password=******,iocharset=utf8,file_mode=0777,dir_mode=0777,sec=ntlmssp  0  0
//192.168.0.100/nas3  /mnt/nas3 cifs    uid=0,username=nas,password=******,iocharset=utf8,file_mode=0777,dir_mode=0777,sec=ntlmssp  0  0
//192.168.0.100/nas4  /mnt/nas4 cifs    uid=0,username=nas,password=******,iocharset=utf8,file_mode=0777,dir_mode=0777,sec=ntlmssp  0  0
</code></pre>
<p>Remember to change the IP address to whatever your local RPi is using. The username and password should probably be stored in a separate file, but just to keep things simple, I&apos;ll leave it inline.<br>
Mount your drives</p>
<pre><code class="language-bash">sudo mount -av
</code></pre>
<!--kg-card-end: markdown-->]]></content:encoded></item><item><title><![CDATA[How to make sure service is running after restart]]></title><description><![CDATA[<!--kg-card-begin: markdown--><p>If you want to avoid situation when after server restart you have to start lots of services manually, a little thing like <code>chkconfig</code> would come in handy.<br>
First you might want to take a look at a list of services handled by <em>chkconfig</em>:</p>
<pre><code class="language-bash">chkconfig --list
</code></pre>
<p>You should see something like</p>]]></description><link>https://allurcode.com/how-to-make-sure-service-is-running-after-restart/</link><guid isPermaLink="false">5b7b0aa2b52b43084c9ea11c</guid><category><![CDATA[bash]]></category><category><![CDATA[chkconfig]]></category><category><![CDATA[Linux]]></category><dc:creator><![CDATA[Wojtek]]></dc:creator><pubDate>Wed, 24 Mar 2010 20:18:09 GMT</pubDate><content:encoded><![CDATA[<!--kg-card-begin: markdown--><p>If you want to avoid situation when after server restart you have to start lots of services manually, a little thing like <code>chkconfig</code> would come in handy.<br>
First you might want to take a look at a list of services handled by <em>chkconfig</em>:</p>
<pre><code class="language-bash">chkconfig --list
</code></pre>
<p>You should see something like this:</p>
<pre><code class="language-bash">mysql 0:off 1:off 2:on 3:on 4:on 5:on 6:off
named 0:off 1:off 2:off 3:on 4:off 5:off 6:off
sshd 0:off 1:off 2:on 3:on 4:on 5:on 6:off
</code></pre>
<p>To add for example mysql to autostart list simply type:</p>
<pre><code class="language-bash">chkconfig --add mysql on
</code></pre>
<p>To remove a service from autostart list type:</p>
<pre><code class="language-bash">chkconfig --del mysql
</code></pre>
<p>For full list of <code>chkconfig</code> options go <a href="http://linuxcommand.org/man_pages/chkconfig8.html">here</a>.</p>
<!--kg-card-end: markdown-->]]></content:encoded></item><item><title><![CDATA[How to install memcached on CentOS]]></title><description><![CDATA[<!--kg-card-begin: markdown--><h3 id="installdependancy">Install dependancy</h3>
<p>Before we install <strong>memcached</strong> we need a dependency library <strong>libevent</strong>. Check for latest stable version at <a href="https://monkey.org/~provos/libevent/">https://monkey.org/~provos/libevent/</a></p>
<pre><code class="language-bash">cd /usr/local/src
wget http://monkey.org/~provos/libevent-1.4.13-stable.tar.gz
tar -xzvf libevent-1.4.13-stable.tar.gz
cd libevent-1.4.13-stable
./configure --prefix=</code></pre>]]></description><link>https://allurcode.com/how-to-install-memcached-on-centos/</link><guid isPermaLink="false">5b7b0aa2b52b43084c9ea119</guid><category><![CDATA[bash]]></category><category><![CDATA[CentOS]]></category><category><![CDATA[libevent]]></category><category><![CDATA[Linux]]></category><category><![CDATA[memcached]]></category><dc:creator><![CDATA[Wojtek]]></dc:creator><pubDate>Sat, 13 Mar 2010 01:28:50 GMT</pubDate><content:encoded><![CDATA[<!--kg-card-begin: markdown--><h3 id="installdependancy">Install dependancy</h3>
<p>Before we install <strong>memcached</strong> we need a dependency library <strong>libevent</strong>. Check for latest stable version at <a href="https://monkey.org/~provos/libevent/">https://monkey.org/~provos/libevent/</a></p>
<pre><code class="language-bash">cd /usr/local/src
wget http://monkey.org/~provos/libevent-1.4.13-stable.tar.gz
tar -xzvf libevent-1.4.13-stable.tar.gz
cd libevent-1.4.13-stable
./configure --prefix=/usr/local
make
make install
cd ..
</code></pre>
<h3 id="installmemcached">Install memcached</h3>
<p>Check for latest stable version at <a href="https://memcached.org/">https://memcached.org/</a></p>
<pre><code class="language-bash">wget http://memcached.googlecode.com/files/memcached-1.4.4.tar.gz
tar -xzvf memcached-1.4.4.tar.gz
cd memcached-1.4.4
LDFLAGS=&apos;-Wl,--rpath /usr/local/lib&apos;
./configure --prefix=/usr/local
make
make install
</code></pre>
<p>More information about LDFLAGS <a href="https://en.wikipedia.org/wiki/Linker">https://en.wikipedia.org/wiki/Linker</a></p>
<h3 id="runmemcachedasadaemon">Run memcached as a daemon</h3>
<p>Basic options: d = daemon, m = memory, u = user, l = IP to listen to, p = port</p>
<pre><code class="language-bash">memcached -u root -d
</code></pre>
<p>or</p>
<pre><code class="language-bash">memcached -u root -d -m 512 -l 127.0.0.1 -p 11211
</code></pre>
<p>To stop daemon type</p>
<pre><code class="language-bash">pkill memcached
</code></pre>
<p>Now we&#x2019;re off to installing <a href="https://allurcode.com/how-to-run-memcache-in-php/">php extension memcache</a>.</p>
<!--kg-card-end: markdown-->]]></content:encoded></item><item><title><![CDATA[Install xmpppy on CentOS]]></title><description><![CDATA[<!--kg-card-begin: markdown--><p>xmpppy is a Python library allowing you to send messages from your server to any Jabber enabled communicator.<br>
Firstly download and unpack <a href="http://xmpppy.sourceforge.net/">xmpppy</a> to a local directory. Next go into the unpacked directory and run:</p>
<pre><code class="language-bash">python setup.py install
</code></pre>
<p>Next you need a script that will do the sending. Use</p>]]></description><link>https://allurcode.com/install-xmpppy-on-centos/</link><guid isPermaLink="false">5b7b0aa2b52b43084c9ea113</guid><category><![CDATA[bash]]></category><category><![CDATA[jabber]]></category><category><![CDATA[Linux]]></category><category><![CDATA[xmpppy]]></category><dc:creator><![CDATA[Wojtek]]></dc:creator><pubDate>Thu, 23 Apr 2009 17:27:01 GMT</pubDate><content:encoded><![CDATA[<!--kg-card-begin: markdown--><p>xmpppy is a Python library allowing you to send messages from your server to any Jabber enabled communicator.<br>
Firstly download and unpack <a href="http://xmpppy.sourceforge.net/">xmpppy</a> to a local directory. Next go into the unpacked directory and run:</p>
<pre><code class="language-bash">python setup.py install
</code></pre>
<p>Next you need a script that will do the sending. Use your favourite text editor to create file i.e.:</p>
<pre><code class="language-bash">vim xsend.py
</code></pre>
<p>Just paste below script which was taken from original site. Create another jabber account that you&#x2019;ll send messages from and remember to change values in line 20 to those new login details.</p>
<pre><code class="language-python">#!/usr/bin/python
# $Id: xsend.py,v 1.8 2006/10/06 12:30:42 normanr Exp $ 
import sys,os,xmpp,time
if len(sys.argv) &lt; 2:
    print &quot;Syntax: xsend JID text&quot;
    sys.exit(0)

tojid=sys.argv[1]
text=&apos; &apos;.join(sys.argv[2:])

jidparams={}
if os.access(os.environ[&apos;HOME&apos;]+&apos;/.xsend&apos;,os.R_OK):
    for ln in open(os.environ[&apos;HOME&apos;]+&apos;/.xsend&apos;).readlines():
        if not ln[0] in (&apos;#&apos;,&apos;;&apos;):
            key,val=ln.strip().split(&apos;=&apos;,1)
            jidparams[key.lower()]=val
for mandatory in [&apos;jid&apos;,&apos;password&apos;]:
    if mandatory not in jidparams.keys():
        open(os.environ[&apos;HOME&apos;]+&apos;/.xsend&apos;,&apos;w&apos;).write(&apos;#Uncomment fields before use and type in correct credentials.\n#JID=romeo@montague.net/resource (/resource is optional)\n#PASSWORD=juliet\n&apos;)
        print &apos;Please point ~/.xsend config file to valid JID for sending messages.&apos;
        sys.exit(0)

jid=xmpp.protocol.JID(jidparams[&apos;jid&apos;])
cl=xmpp.Client(jid.getDomain(),debug=[])

con=cl.connect()
if not con:
    print &apos;could not connect!&apos;
    sys.exit()
print &apos;connected with&apos;,con
auth=cl.auth(jid.getNode(),jidparams[&apos;password&apos;],resource=jid.getResource())
if not auth:
    print &apos;could not authenticate!&apos;
    sys.exit()
print &apos;authenticated using&apos;,auth

#cl.SendInitPresence(requestRoster=0)   # you may need to uncomment this for old server
id=cl.send(xmpp.protocol.Message(tojid,text))
print &apos;sent message with id&apos;,id

time.sleep(1)   # some older servers will not send the message if you disconnect immediately after sending

#cl.disconnect()
</code></pre>
<p>All you need to do now is to run the script &#x1F642; First run will create a file in your home directory which should contain username and password from line 20. Second run should accually send the message.</p>
<pre><code class="language-bash">./xsend.py your_main_jabber@your_jabber.com Hello world!
</code></pre>
<p>Now set up your monitoring scripts that will send you jabber messages when something goes wrong.</p>
<!--kg-card-end: markdown-->]]></content:encoded></item></channel></rss>