Αρχείο για Μαρτίου, 2018

Another option you can employ is xkill. This is preinstalled in Ubuntu, but you can install it via the Terminal (which you can open with CTRL + ALT + T) if necessary. When called, xkill will enable you to close any desktop app. Install it with the following command:

sudo apt-get install xorg-xkill

Once this is done, run xkill by simply typing

xkill

Your mouse pointer will then display a cross (or a skull), and all you need to do is left-click on the offending application.

If it’s not possible to close your unresponsive app with any of these desktop-focused methods, the solution might be the command line…

1) Download a driver for linux from Samsung. Samsung M2070 Linux Printer/Scanner Driver (15.87 MB) is at http://www.samsungdrivers.net/samsung-m2070-driver/

2) Unzip your downloaded file.

3) Make sure about the location of the directory which contains a file named » install.sh «. It must be in downloads/XXXX(You named!!)/ uld.

I repeat. » install.sh » is in ULD.

4) Open TERMINAL to go to the directory which has » install.sh » in it.

cd downloads

cd XXXX

cd uld

5) Install a driver by command.

sudo ./install.sh

Note that you have to hit «Enter» many many times to reach the line which asks you to choose y/n. Go slow. Otherwise you’ll have to go back to the directory of ULD and command again.

Send Email when IP Address Changes

Posted: 6 Μαρτίου 2018 in linux
Ετικέτες: , , , ,

1. Setup Gmail and sSMTP

This time we are using sSMTP because it’s easy, and Gmail because it’s free.

I would prefer to create a new Gmail account specific only for this purpose. Use your creativity to create long and obfuscated password, e.g. with mkpasswd -m sha-512 yOuRp4ssW0rD you can get a long string which is should be very nice for password.

Next, install sSMTP and its mail “client”:

sudoapt-get install ssmtp mailutils

Then edit the config file at /etc/ssmtp/ssmtp.conf:

 

root=youremail@gmail.com
mailhub=smtp.gmail.com:587
AuthUser=youremail@gmail.com
AuthPass=yOuRfUnKyP4ssWorD
UseTLS=YES
UseSTARTTLS=YES
AuthMethod=LOGIN

sSMTP is not a daemon, so don’t worry about starting the service or such.

Next, test your setup:

echo"test message"| mail -s "testing ssmtp"yourothermail@gmail.com

Note the blank like after the subject, everything after this line is the body of the email. When you’re finished, press Ctrl-D. sSMTP may take a few seconds to send the message before closing.

apt-get install curl

2. The Script

#!/bin/bash
 
#Script to report public IP address change
#By: Soultidis D. Christos
 

curl ipinfo.io/ip > /home/username/emailscript/erxeteip.txt


oldip=`cat /home/username/emailscript/oldip.txt`
erxeteip=`cat /home/username/emailscript/erxeteip.txt`

if [[ $erxeteip = $oldip ]]
then

    #echo $oldip > /home/username/emailscript/oldip.txt
    echo "Kamia allagi"

else
    echo $erxeteip > /home/username/emailscript/newip.txt
echo $erxeteip > /home/username/emailscript/oldip.txt


    cat /home/username/emailscript/newip.txt | mailx -s "Dynamic Public IP Address" youremail@gmail.com

fi

This time we use Bash, because you might not realize that you’re already fluent with Bash.

Save this anywhere in your home folder. I personally have my own /home/username/emailscript/

 

3. Cron
To make this run periodically, add the script as a cron job. More detail on cron you can STFG (Search The Fine Google).

crontab -e

Then add this to run the script every 30 minutes

#*/30 * * * * /home/username/emailscript/ip.sh >/dev/null 2>&1

ΥΓ. θα πρέπει να δημιουργήσω το oldip.txt

 

Cron daemon is not running. I really screwed up with this some months ago.

Type:

pgrep cron 

If you see no number, then cron is not running. sudo /etc/init.d/cron start can be used to start cron.

EDIT: Rather than invoking init scripts through /etc/init.d, use the service utility, e.g.

sudo service cron start

site

Posted: 3 Μαρτίου 2018 in Uncategorized

http://www.github.com