[HOW TO] use cron on Synology NAS

Morning Guys,

Today I show you how to set the cron on Synology NAS.
Basically Synology OS have core OS is unix. Thus it's the same about core service - I think so.

Unlike Linux based system, you do not use "crontab -e/ -l on the Synology NAS.

You must go as below:

$sudo -i

$nano /etc/crontab

Here you can edit the cron

$synoservice -restart crond

To restart the cron

Also you can run the task under the username myuser as below:


#min    hour            mday    month   wday    who     command
30      0,6,12,18       *       *       *       root    /bin/su -c "/var/services/homes/myuser/apps/flexget.sh" myuser
 
Thank you, 
 
 Reference: http://www.multigesture.net/articles/how-to-use-cron-on-a-synology-nas/ 

[HOW TO] install Citrix Reciver in Ubuntu?

Morning,

Do you know citrix receiver (ica client)?

In this article, I show you how to install the citrix receiver in Ubuntu?

Firstly you come Citrix official to download the version x64 for Ubuntu 64-bit or x86 for Ubuntu 32-bit.

Here I use the icaclient_13.0.0.256735_amd64.deb. Dpkg command will help you install as below:

ho-pc-nvhviet tmp # dpkg -i icaclient_13.0.0.256735_amd64.deb
(Reading database ... 177430 files and directories currently installed.)
Preparing to unpack icaclient_13.0.0.256735_amd64.deb ...
Unpacking icaclient (13.0.0.256735) over (13.0.0.256735) ...
dpkg: dependency problems prevent configuration of icaclient:
 icaclient depends on libc6-i386 (>= 2.7-1); however:
  Package libc6-i386 is not installed.
 icaclient depends on lib32z1; however:
  Package lib32z1 is not installed.
 icaclient depends on nspluginwrapper; however:
  Package nspluginwrapper is not installed.

dpkg: error processing package icaclient (--install):
 dependency problems - leaving unconfigured
Processing triggers for desktop-file-utils (0.22-1ubuntu1) ...
Processing triggers for mime-support (3.54ubuntu1) ...
Errors were encountered while processing:
 icaclient


What the fuck? oh it alerts it can not get the dependencies. You must go to the internet to download them. My company has Cyberoam as firewall. Thus I must authenticate.

Done! now try it.

I use the apt-get -f install to automatically download miss dependencies.

ho-pc-nvhviet tmp # apt-get -f install
Reading package lists... Done
Building dependency tree      
Reading state information... Done
Correcting dependencies... Done
The following extra packages will be installed:
  lib32z1 libc6-i386 nspluginviewer:i386 nspluginwrapper
The following NEW packages will be installed:
  lib32z1 libc6-i386 nspluginviewer:i386 nspluginwrapper
0 upgraded, 4 newly installed, 0 to remove and 42 not upgraded.
1 not fully installed or removed.
Need to get 2.465 kB of archives.
After this operation, 10,6 MB of additional disk space will be used.
Do you want to continue? [Y/n] y
Get:1 http://archive.ubuntu.com/ubuntu/ trusty-updates/main libc6-i386 amd64 2.19-0ubuntu6.3 [2.205 kB]
Get:2 http://archive.ubuntu.com/ubuntu/ trusty/main lib32z1 amd64 1:1.2.8.dfsg-1ubuntu1 [57,5 kB]
Get:3 http://archive.ubuntu.com/ubuntu/ trusty/multiverse nspluginviewer i386 1.4.4-0ubuntu5 [86,3 kB]
Get:4 http://archive.ubuntu.com/ubuntu/ trusty/multiverse nspluginwrapper amd64 1.4.4-0ubuntu5 [115 kB]
Fetched 2.465 kB in 4s (566 kB/s)       
Selecting previously unselected package libc6-i386.
(Reading database ... 177430 files and directories currently installed.)
Preparing to unpack .../libc6-i386_2.19-0ubuntu6.3_amd64.deb ...
Unpacking libc6-i386 (2.19-0ubuntu6.3) ...
Replaced by files in installed package libc6:i386 (2.19-0ubuntu6.3) ...
Selecting previously unselected package lib32z1.
Preparing to unpack .../lib32z1_1%3a1.2.8.dfsg-1ubuntu1_amd64.deb ...
Unpacking lib32z1 (1:1.2.8.dfsg-1ubuntu1) ...
Selecting previously unselected package nspluginviewer.
Preparing to unpack .../nspluginviewer_1.4.4-0ubuntu5_i386.deb ...
Unpacking nspluginviewer (1.4.4-0ubuntu5) ...
Selecting previously unselected package nspluginwrapper.
Preparing to unpack .../nspluginwrapper_1.4.4-0ubuntu5_amd64.deb ...
Unpacking nspluginwrapper (1.4.4-0ubuntu5) ...
Processing triggers for man-db (2.6.7.1-1ubuntu1) ...
Setting up libc6-i386 (2.19-0ubuntu6.3) ...
Setting up lib32z1 (1:1.2.8.dfsg-1ubuntu1) ...
Setting up nspluginviewer (1.4.4-0ubuntu5) ...
Setting up nspluginwrapper (1.4.4-0ubuntu5) ...
plugin dirs:
Auto-update plugins from /usr/lib/mozilla/plugins
Looking for plugins in /usr/lib/mozilla/plugins
Auto-update plugins from /usr/lib/firefox/plugins
Looking for plugins in /usr/lib/firefox/plugins
Auto-update plugins from /root/.mozilla/plugins
Looking for plugins in /root/.mozilla/plugins
Setting up icaclient (13.0.0.256735) ...
Processing triggers for libc-bin (2.19-0ubuntu6.3) ...


It's ok. The dependencies already installed.

Again I try to install icaclient_13.0.0.256735_amd64.deb 

ho-pc-nvhviet tmp # dpkg -i icaclient_13.0.0.256735_amd64.deb
(Reading database ... 177770 files and directories currently installed.)
Preparing to unpack icaclient_13.0.0.256735_amd64.deb ...
Unpacking icaclient (13.0.0.256735) over (13.0.0.256735) ...
Setting up icaclient (13.0.0.256735) ...
Processing triggers for desktop-file-utils (0.22-1ubuntu1) ...
Processing triggers for mime-support (3.54ubuntu1) ...


Successfully!
Nice day :)


[HOW TO] PostgresSQL add/create/delete user account and grant permission

Hello,

In the afternoon I have configured the Postgres database for one developer. After finished, I think I should write a little article about Postgres installtion.

Let's start!

1. Install the postgres
 t13n@ho-pc-pttien:~$ sudo apt-get install postgresql postgresql-contrib

With that, postgres will be installed on your PC

2. Check the authentication way
 t13n@ho-pc-pttien:~$ sudo vi /etc/postgresql/9.1/main/pg_hba.conf

This is  PostgreSQL Client Authentication Configuration File.

METHOD can be "trust", "reject", "md5", "password", "gss", "sspi",
# "krb5", "ident", "peer", "pam", "ldap", "radius" or "cert".  Note that
# "password" sends passwords in clear text; "md5" is preferred since
# it sends encrypted passwords.


Come to line below and change from peer to trust
# Database administrative login by Unix domain socket
local   all             postgres                                trust


Restart the Postgres
 t13n@ho-pc-pttien:~$ sudo /etc/init.d/postgresql restart

When you do it, you allow postgres user can login without password. It's risk :) but you can improve laster. I think the first you must understand it before attack it.


 3. Login with postgres user
 t13n@ho-pc-pttien:~$psql -U postgres

4. Create a new user
postgres=# CREATE USER thminh_1 with password '0********';
CREATE ROLE

5. Update the password for user
postgres=# ALTER USER postgres with password '0123456789';
ALTER ROLE


6. Delete the user
postgres=# DROP USER thminh_1

7. Set the user to be a superuser
postgres=# ALTER USER thminh_1 WITH SUPERUSER;
ALTER ROLE


8. Connect to database server
Type the following command

$psql temp01

or

$psql -d temp01 -U postgres

9. Create database
temp01#CREATE DATABASE hello;

10. Grant the privileges on database
temp01#GRANT ALL PRIVILEGES ON DATABASE hello to your_user

11. \q to quit
temp01#\q

12. Test your_user login

$su - your_user
$psql -d hello -U your_user






[HOW TO] configure the log file of cron job in SuseSLES

Hello,

Yesterday I have configured the log file to crontab on SuseSLES 11SP3. In SuseSLES, if you don't enable crotanb log in /etc/syslog-ng/syslog-ng.conf then syslog-ng don't write.


Here I show you the step by step:


1. Go to /etc/syslog-ng, vi syslog-ng.conf and uncomment the line: #cron.*

2. Restart the cron service
#sudo /etc/init.d/syslog restart
3. Restart cron service
#sudo /etc/init.d/cron

You can go go /var/log/ to view the log file of cron.log