Rsync with SSH


On source server:

rsync -arvz -e 'ssh -p 22' –progress /local-folder remote_user@remote_ip:/remote-folder 

Shell install/uninstall apk file


Show devices
adb devices

Install apk
adb install apk_name.apk

Unistall
adb shell

Find out your apps package name:
pm list packages | grep "app name/something related to your app name"

Then use:
adb uninstall package_name

OR
pm uninstall package_name

Zimbra mailbox usage report

A way to get an emailable report of all mailboxes in a domain, their quota, usage and account status, so a domain admin can review their accounts without having to login to zimbra. (most of this is the same as viewing quota usage in zimbra admin, but this was easier, as it can then be emailed on a schedule)

I saved this file in /opt/zimbra/backup/scripts/ as usagereport.sh, owned by zimbra.zimbra chmod 755 accountusage.sh

#!/bin/bash

SMTP="10.0.0.2"
FROM="user@yourdomain.com"
TO="user@yourdomain.com"
SUB="Mailbox Usages"
MSG="Mailbox Usages"

output="/tmp/accountusage.csv"
domain="yourdomain.com"
SendTo="user@yourdomain.com"

rm -f $output
touch $output

server=`zmhostname`
/opt/zimbra/bin/zmprov gqu $server|grep $domain|awk {'print $1" "$3" "$2'}|sort|while read line
do
usage=`echo $line|cut -f2 -d " "`
quota=`echo $line|cut -f3 -d " "`
user=`echo $line|cut -f1 -d " "`
#status=`/opt/zimbra/bin/zmprov ga $user | grep  ^zimbraAccountStatus | cut -f2 -d " "`

#with status
#echo "$user; `expr $usage / 1024 / 1024`MB; `expr $quota / 1024 / 1024`MB; ($status account)" >> $output

# without status
echo "$user; `expr $usage / 1024 / 1024`MB; `expr $quota / 1024 / 1024`MB" >> $output
done

#cat $output | mail @SendTo -s"Mailbox Usages for $domain"

sendemail -q -o tls=no -f $FROM -t $TO -u $SUB -m $MSG -s $SMTP:25 -a $output

Create linux systemd service


Create the file
/etc/systemd/system/routes.service


File content:

[Unit]
Description=Routes
After=multi-user.target

[Service]
Type=idle
ExecStart=/etc/init.d/routes.sh

[Install]
WantedBy=multi-user.target


Now lets enable service:
systemctl enable routes.service

If your script have start/stop options, change the ExecStart:
ExecStart=/etc/init.d/routes.sh start
ExecStop=/etc/init.d/routes.sh stop


Create New Sudo User in Ubuntu


Create a new user

sudo useradd -m -s /bin/bash -c "Administrative User" admin

Create a password for the admin user using the passwd utility

$ sudo passwd admin

To enable the user admin to invoke sudo to perform administrative tasks, you need to add the user to the sudo system group using the usermod command as follows, where the -a option means to append user to a supplementary group and -G specifies the group.
 
sudo usermod -aG sudo admin

Now test sudo access on a new user account by switching to admin’s account (enter admin’s account password when prompted).
 
su - admin


View linux boot time


View boot time:

systemd-analyze

View boot time by service

systemd-analyze blame


To disable a service:
sudo systemctl disable NetworkManager-wait-online.service 

To enable:
sudo systemctl enable NetworkManager-wait-online.service 

 

Disable apport at boot



pico /etc/default/apport

Change the line that says enabled=1 to enabled=0 to disable Apport.
To re-enable, change it back.

Zimbra - View all sessions

As zimbra user

/opt/zimbra/bin/zmsoap -z -v GetSessionsRequest @type=soap

/opt/zimbra/bin/zmsoap -z -v GetSessionsRequest @type=imap

/opt/zimbra/bin/zmsoap -z -v GetSessionsRequest @type=admin

Install MSIX with powershell

 Add-AppxPackage -Path "C:\Users\MyUserName\Downloads\affinity-designer-2.0.0.msix" -DependencyPath " https://aka.ms/Microsof...

Mais vistos