Tag: DS209+

  • Migration from my DS209+ to my DS713+

    I have just moved my blog from my Synology DS209+ to my new DS713+.

    If you see this, it means that the migration is successful 😉

    Click to Read More

    The setup of the new DS713+ was straightforward and really easy using the setup Wizard of Synology. It took more time to screw the two drives (WD SE 2TB WD2000F9YZ) in the trays. Those trays look cheap (plastic) and fragile, but they are really easy to use, plug and unplug.

    1/ I did use http://find.synology.com to search for my new DS. It worked fine and found both the 209+ and the 713+. From there I did start the setup on the 713+. It automatically download the latest version of DSM and install it.

    2/ Once installed, a wizard opens within DSM to configured the most important features:

    1. Create a volume with the disks (I didn’t create the default “Hybrid RAID (SHR)” as already suggested during the setup. I did a RAID 0 using the wizard instead).
    2. Users and Shared Folders
    3. File Station
    4. Other Packages (I did re-install all my favorite packages): Audio Station, Cloud Station, CouchPotato Custom*, DNS Server, Download Station, Git, Mail Server, Mail Station, Media Server, Photo Station, phpMyAdmin, Plex Media Server, Python, Python 3, Surveillance Station Time Backup, Video Station, Web Console*, Config File Editor*, Webalizer, WordPress

    3/ In the Package Center, I did reconfigure the custom “Package Sources” (required for * above):

    1. http://packages.missilehugger.com : ‘Config File Editor’ and ‘Web Console’
    2. http://packages.synocommunity.com : ‘Couch Potato Server’
    3. http://www.cphub.net : ‘Advanced Power Manager’
    4. http://packages.quadrat4.de : IPKG ‘Bootstrap installer’, …

    4/ Via the Control Panel  > Terminal, I did enable “telnet”

    5/ I did next set a fix IP for the DS713+ on my DD-WRT router (under “static leases” in the “Service” tab) and did connect on the DS713+ via telnet to force it to renew its IP with the command “/etc/rc.network restart”

    6/ I did also reinstall the package Perl, BootStrap Installer (Install Ipkg) and iPKGui  (manage ipkg packages) – both from packages.quadrat.de –  and configured the following package source: http://ipkg.nslu2-linux.org/feeds/optware/syno-e500/cross/unstable (name ‘cross’, type ‘scr/gz’, file ‘cross-feed.Conf’)

    7/ I did install the “web-Console” package and logged in with admin/admin. Then I did restart the web-console after changing the password via the command (typing also the #) : #users modify admin

    Notice: I didn’t use Synlogy’s migration wizard to backup and restore the full “configuration settings” as I wanted to clean a bit my NAS and restore/reconfigure only what I really still need. More details on migration methods are provided on Synology’s wiki.

    Click to Read ‘Wordpress’ Part

    1/ Regarding WordPress, once the package installed, I did:

    1. Export the ‘wordpressblog’ database from my DS209+
    2. I did copy the following folders from the DS209+ on the DS713+
      1. \wordpress\wp-content\icons
      2. \wordpress\wp-content\themes
      3. \wordpress\wp-content\uploads
      4. \wordpress\wp-content\plugins
    3. I did restore that backup on the DS713+
    4. I had to reset the “Header Image” via Appearance>Themes>Customize.
    5. I did check that all the plugin’s where enabled. All settings where correctly recovered from the backup restored previously.

    I didn’t re-install the plugin MultiDomain as I am now using the DNS package of Synology to solve the issue I had in the past when accessing my blog from my intranet or from internet.

    2/ I did copy the other webpages in /web from the DS209+ onto the DS713+

    3/ I did reconfigure the port-forwarding on my DD-WRT (via the tab “NAT/QoS”) to forward the traffic on port 80 to the DS713+ instead of DS209+. I also configured “Wake on Lan” on the DD-WRT (via the “Administration” > “WOL”) to be able to wake-up my new NAS although it should run 24/7.

    Et voilà… the “web part” of the DS713+ is up and running 😛

    Click to Read ‘Photo Station’ Part

    1/ To move the Photo albums, I did use Synology’s “Main menu” > “Backup and Restore” feature on the DS209+.

    1. On the DS713+, enable the “Network Backup” service (without rsync) via “Main Menu” > “Network Backup”. This is going to create a Shared Folder ‘NetBackup’.
    2. Back to the DS209+, In the “Backup” tab of the “Backup and Restore” wizard, click create and select “Data Backup type”.
    3. In the wizard, type a name for the backup and select “Network Backup (Synology Server)”. Let the DS209+ find the DS713+ (clicking into the “server name” combo-box) and use this one as server name for the backup destination (fill manually the password for the username and pick “NetBackup” as shared folder. Keep in mind the name of the “folder” to be created in “NetBackup” to store the backup).
    4. In the tab where you can select application data, configuration, etc… pick
      1. In the “Application” part, select “Photo Station”
      2. In the “Shared folder” part, select “photo”
    5. And finally “Back up immediately after the wizard finished”

    2/ Next, on the DS713+, using the same  “Main menu” > “Backup and Restore” feature, I did the restore

    1. In the “Restore” tab, click on “Restore” and select “data”.
    2. In the wizard, select “Local Restoration” and keep next “NetBackup” and select the name of the “folder” where the DS209+ stored its backup.
    3. Do not select any “configuration settings to restore”
    4. Select however all “items to restore” in the next screen. You will see that there is a “conflict” for the Shared Folder “photo”. No matter, the existing folder on the target will be overwritten.

    Et voilà. It’s magic: all the photo and thumbnails are restored, including the albums, smart albums, covers, etc…

    One thing is however not restored via this process: the users’ privileges… I presume that this is because I didn’t restore the users table. I had to grant access to the users to each album manually via the “Parameters” > “User accounts” menu of Photo Station.

    Click to Read ‘Surveillance Station’ Part

    1/ To move the Surveillance Station settings, I did use also Synology’s “Main menu” > “Backup and Restore” feature on the DS209+.

    1. First, I did disable all my camera in the Surveillance Station of the DS209+ via the “Main Menu” > “Surveillance Station” > “IP Camera”
    2. Next, I did delete all the records as I wanted to only migrate the “settings”
    3. Finally, I did a backup of ‘surveillance’ as I did for the Photo Station here above. I only had to provide another folder-name under ‘NetBackup’ than for the photo

    2/ Next, on the DS713+, I did

    1. “Stop” the Surveillance Station, via “Package Center” > “Surveillance Station” > Action “Stop”.
    2. Restore the ‘surveillance’ following the same procedure as for the Photo Station.
    3. Once the restore completed, “Run” the Surveillance Station, via “Package Center” > “Surveillance Station” > Action “Run”.
    4. Go to the “Main Menu” > “Surveillance Station”  > “IP Camera” and re-enable the camera. You can see that not only the camera are restored, but also the patrol settings, etc…

    Notice: the paid licences have been transferred !!! What is weird: I was able to re-enable the camera also on the DS209+. Both NAS were then consuming stream from all the camera… I was not expecting the licenses to be usable on several devices ?!

    Click to Read ‘Audio and Video Station’ Part

    1/ Simply copy the content of the Shared Folders “music” and “video” from DS209+ to DS713+. Audio Station and Video Station will re-index the files.

    2/ Reconfigure Video Station (Collections and Custom Libraries must be redefined)

    3/ Recreate your favorite Web Radio Station in the Audio Station

    This is a bit of work but I didn’t find a backup/restore similar to the one available for the ‘photo’ and the ‘surveillance’. And I didn’t want to restore the full configuration of my DS209+ as-is.

    Click to Read ‘Other’ Part

    1/ Reconfigure the other port-forwarding rules on the DD-WRT to transfer all required traffic to the DS713+:

    1. Admin: 5000
    2. WebDav and WebDav https: 8000 and 8443
      1. Enable WebDav via “Main Menu” > “Control Panel” > “WebDAV”
      2. Configure the port 8000 and 8443 resp. for http
    3. CouchPotato: 5050

    2/ Reconfigure the WorkGroup via “Main Menu” > ” Configuration Panel” > “Win/Mac/NFS” > “Windows File Service”

    3/ Enable “Recycle Bin”, “Windows ACL” and “File Indexing” on required shared folders via “Main Menu” > ” Configuration Panel” > “Shared Folder” > (select a folder) “Edit”.

    4/ Reconfigured the “DNS server” as made on DS209+. Or, use the “Export Zone” > “Complete Zone settings” menu of the “DNS Server” on DS209+ and then “Create” > “Import Zone” menu of the “DNS Server” on the new DS.

    5/ Recreate the MySQL Backup Task and the reconfigure Time Backup’s tasks.

    Click to Read ‘DDNS’ Part

    I also had to register my DDNS’ domain name olympe.diskstation.me for my new DS713+ instead of for my DS209+.

    1/ Log in https://myds.synology.com

    2/ Click on the “Unlink” icon on the row of your old DS.

    3/ Select the old DS and click on “Delete” on the right side of the “DDNS status” header.

    4/ Go now to the “Control Panel” of the new DS and click on “DDNS”.

    5/ Click on “Add” and re-register the DS with the domain name that used to be linked to the old DS.


  • The perfect AirPlay Speaker for my Synlogy

    I just bought 3 x Philips Fidelio SoundAvia wireless speaker AD7000W/12 with AirPlay. This model is must cheaper than any other AirPlay device and fully compatible with my Synology DS209+ running the Audio Station of DSM 4.2.

    Click to Read More

    Philips Fidelio AD7000W/12
    Philips Fidelio AD7000W/12

    I paid only 109€ (instead of the official price: 149€) for this device, which is reported as a good one (Look for reviews on the web). It’s especially much cheaper than any other devices except the Philips DS3800W/10. But this last one, which actually used to be more expansive than the AD7000W/12 in the past, is not as good although better designed. I took 3 AD7000W/12 (for the price of one single Soundlink Air, the cheapest Bose AirPlay device). I will  use them respectively in the bathroom, in the kitchen and in my room.

    It’s perfect for a Synology as there is not useless feature, like a docking for iStuff that don’t need, no remote control as I have my mobile phone, etc… So I paid only for what I really need: a basic AirPlay Speaker.

    Take note that there is no need for an iPad, iPod or iPhone to configure the Philips Fidelio AD7000W/12. It’s presumed to be configurable auto-magically via WPS but I didn’t succeed to do so (I.e.: using the PBC – Push-Button Configuration – which is the WiFi setup button on the back of the device). Fortunately, it is really easy to configure the AD7000W/12 with a browser from any wireless client device such as a tablet, a laptop, a mobile phone, …

    Notice: when unwrapping the device, on the connectors at the back of device, there is a sticker explaining that one has to push the physical WiFi setup button for 5 sec to configure the network for the first time. This could be confusing if you read next the Quick Guide. Indeed, this one explains two ways to connect the device to the WiFi router: a first method using WPS and a second method using an iStuff. In both cases, you have to press the physical WiFi setup button. But the mistake would be to press this button for 5 seconds when using the WPS method. It must only be pressed for 5 seconds if you want to use the second method. So, here is my experience:

    1. Switch on the device. The button is on the back, close to the top, next to the Volume + and – buttons.
    2. On the back too, there is a green led blinking rapidly in the middle of the WiFi setup button, at the bottom, on the right of the USB connector. Wait for 35 sec until it starts to blink slowly. The device is then ready to be configured.

    To connect the AD7000W/12 to a WiFi router using a browser (Connect the devices one by one if you have several):

    1. Press the WiFi setup button for 5 sec (= blinks 5 times). The led will then start to blink alternatively green and orange.
    2. Soon after you should see, with your wireless client device, a new opened WiFi network  named like Philips_Fidelio_AirPlay. Connect to that network.
    3. Open a browser and navigate to to access the network configuration page of the AD7000W/12. If you are using a laptop, althoug configured to get an IP via DHCP, you could have to reconfigure it to use a fixed IP like, gateway, mask I had to do even after I didn’t succeed with a simple “IPConfig /renew”. With a mobile and a tablet, it worked out of the box.
    4. In the configuration page, edit the name of the device to make it unique and select the SSID of the WiFi network on which it will have to connect. It works fine with my network configured to use WPA2.
    5. Type the Passphrase of the WiFi network and Apply the configuration.
    6. The led will restart to blink rapidly in green.
    7. As soon as device is connected on the selected WiFi network, it produces a clear “Beep” sound and the led stops blinking.
    Philips Fidelio Configuration
    Philips Fidelio Configuration

    To connect the device using WPS:

    1. Press the WPS button on your WiFi router. It has better be configured to use WPA2
    2. Press the WiFi setup button on your device (a simple click of less than 1 sec). The led will start to blink alternatively red, green and orange.
    3. Wait for up to 2 minutes. The device should auto-magically connect on the WiFi router and produce a clear “Beep” sound once connected.

    This second approach didn’t work for me ?!

    As soon as the Philips Fidelio AD7000W/12 is connected on the WiFi network, it becomes available as a target device for the Synology Audio Station (either in the Web UI or in the Apps for mobile). One can see targets like “XXX( DLNA)”, “XXX (AirPlay)” and “Multiple AirPlay Device” where XXX is the name you gave to the device (“Philips Fidelio ####” by default). All those targets work but you will possibly have to be patient for the music to arrive with DLNA targets (?). I takes a few seconds more than with AirPlay on my infra.

    If you don’t want to see the speaker as both an AirPlay device and a DLNA device, you must tick “Do not Search for DLNA devices” in the “options” tab of your Audio Station’s settings.

    Notice that the feature “Multiple AirPlay Device” only works if turned on from Audio Station “browser based”. It means that you must first select that target in the Audio Station’s web based UI. You will then be prompted to select which AirPlay devices must be used. Once this is done, you can use the “Multiple AirPlay Device” target also within the Audio Station Apps for tablets and mobiles. There is no support (today) to select via the mobile App which devices are part of the target “Multiple AirPlay Device”.

    Notice also that selecting the target device is really easy on a mobile phone via the App. First select the music to be played in a library. Then, on the next screen you will be able to select the target:

    Audio Station Apps
    Audio Station Apps

    For an unknown reason, it’s not as obvious with the App on my tablet ? To select the target on my table I have indeed to open the settings of the App. This is really not convenient at all!

    Notice finally that each device has its own queue. So you can then switch between target devices and manage their queues independently.


  • Send Custom (email) Notifications from scripts running on a Synology

    I use a custom script on my Synology DS209+ (DSM 4.2) DS713+ (DSM 5.1) to backup the databases and was recently asked how to notify the administrator about the success or the failure of that script. The easiest solution is to use the native Notification mechanism of the DSM. It notifies not only by email but also with popup messages, SMS, Skype, etc….

    If you are using DSM 6.x, look at the new version of this post, located here.

    Click to Read More

    First, create the texts for the Notifications to be sent:

    1. Open a dos command prompt
    2. Execute: telnet <YourSynoHostname>
    3. Login as ‘root’
    4. Use the password of your Administrator
    5. Execute: cd /usr/syno/synoman/webman/texts/
    6. Execute: ls
    7. Now you see a list of folders for each language supported by your Synology. Assuming that your DSM is configured to run in English (the default), we will use here after the folder ‘enu’ (but read the notice at the end of this post if you want to configure Notifications for another language)
    8. Execute: cp enu/mails /volume1/web/
      1. I presume here that the web station is enabled, otherwise, copy the file ‘mails’ in any other shared folder.
      2. This file contains the Notification messages used by the Synology.
    9. Open now this file ‘mails’ with notepad++: \\<yourSynoHostname>\web\mails
    10. Add two new “tags” at the end of the file. E.g.: “MySqlBkpError” and “MySqlBkpOK” (see bellow for details to possibly be used for those tags)
    11. Save the changes.
    12. Back to the telnet console, execute: cp /volume1/web/mails enu/mails
    [MySqlBkpError] Category: Backup/Restore,Important
    Title: Database backup failed
    Subject: Database backup on %HOSTNAME% has failed

    Dear User,

    Database backup on %HOSTNAME% has failed.

    [MySqlBkpOK] Category: Backup/Restore
    Title: Database backup succeeded
    Subject: Database backup on %HOSTNAME% has succeeded

    Dear User,

    Database backup on %HOSTNAME% has successfully completed.

    Next, complete your script to notify the Administrator about the Success or Failure of its last action:

    1. Edit your script with notepad++ once it has been copied in a shared folder of your Synology as made here above with the file ‘mails’.
    2. After the action to be reported, add the code here bellow.
    3. Save your changes and copy the file back to its original location

    if [ $? -eq 0 ] then /usr/syno/bin/synonotify MySqlBkpOK
    else /usr/syno/bin/synonotify MySqlBkpError

    Now, define those custom Notifications to let them appear in the “Advanced” tab of the “Control Panel” > “Notifications” pane where you will be able to enable “email”, “sms”, … for them.

    1. Go back to the telnet console and execute: cp enu/notification_category /volume1/web/
      1. If you want to define those notifications for another language, used the adequate folder instead of ‘enu’.
      2. Notice that I presume you are still in the path set previously, i.e.: /usr/syno/synoman/webman/texts/
    2. Edit the file ‘notification_category’ with notepad++
    3. Look for the following definition in that file: {“group”:”Backup/Restore”,”name”:”NetBkpS3OK”,”title”:”Amazon S3 backup completed”}
    4. Insert the following definition next to it (don’t forget the coma), save the changes and copy the file back to its original location: cp /volume1/web/notification_category enu/notification_category

    ,{“group”:”Backup/Restore”,”name”:”MySqlBkpOK”,”title”:”Database Backup completed”},{“group”:”Backup/Restore”,”name”:”MySqlBkpError”,”title”:”Database Backup failed”}

    Finally, check that the “Notifications” are enabled on your Synology and tick options like emails, SMS, … for the new tags:

    1. In your DSM, go to “Control Panel” > “Notification” > “E-Mail”
    2. Tick the option “Enable e-mail notifications”.
    3. Complete all the fields in that tab. At least: SMTP server, SMTP port, SMTP authentication and Primary email.
    4. Send also a test mail from this tab to verify your settings.
    5. Go next to the “Advanced” tab
    6. Tick the “E-mail” option (and possibly others) for the two new tags which appear now in the list.
      1. If the tags do not appear, close and reopen the control panel.
      2. The tags appear with their title “Database Backup completed” and “Database Backup failed”

    And here are the outcomes: a popup message and an email

    Database Backup Email
    Database Backup Email
    Database Backup Custom Notification
    Database Backup Custom Notification

    Pay attention that the tags are case sensitive ! Also backup the changes you made in the file ‘mails’ and ‘notification_category’ as they will be overwritten for sure when you will update the DSM… Finally, delete the files ‘mails’ and ‘notification_category’ from your web folder…

    Notice: to declare Notifications for other languages, you will apply the tips here above in the files under your own language folder. A reader, Kasak, kindly reported however that he had to declare the ‘tags’ not only in the ‘mails’ file under the folder of his language (E.g.: ‘fre’), but also under the English (enu) folder.

    Notice: as reported by another reader, Pieter Hooftman, you will see your notifications in Control Panel > Notifications > Advanced tab if and only if you filter them on “All Notifications”. If you need to filter your custom notifications, you have to add it into each section of the file “notification_category” (there is one section per filter). Concretely, look for each occurrence of {“group”:”Backup/Restore”,”name”:”NetBkpS3OK” and insert your in front.

    Notice: as reported by k13tas, it’s much easier to reuse an existing notification and customize its text via Control Panel > Notification > Advanced. Indeed, customized text are not lost after a DSM update. That being said, once a custom notification added in the file “notification_category”, you can also customize its text. Once this is done, the notification will always be available to be used with /usr/syno/bin/synonotify, even after a DSM update, although not visible anymore in the Advanced tab – which is far from ideal.

    As creating manually custom notifications is far from ideal, please vote for my feature request on Synology’s forumhttp://forum.synology.com/enu/viewtopic.php?f=3&t=92727


  • Synology surveillance station: Internet Explorer has stopped working

    Since two days, each time I open a Preview, a Live View or the Timeline in my Surveillance Station, IE crashes. Presuming it could due to the Synology ActiveX used by those features, I have removed that one. And Bingo, it’s fixed.

    Click to Read More

    No idea how that ActiveX has been corrupted, but here it how to remove it.

    1. Press AltX to open the Tools menu
    2. Select “Manage Add-ons”
    3. In Add-on Types, keep “Toolbars and Extensions” selected
    4. Scroll down to find the extension “SS3Object Control”. Select it.
    5. In the bottom pane, click on “More information”
    6. You have now a popup window “More information” with a “Remove” button at the very bottom. Click that button.
    7. Reopen Surveillance Station. The ActiveX will be re-installed. But now, the problem is gone…


  • From WordPress 3.3 to 3.4 on Synology: Almost YAUN !!

    No! I don’t mean “Yet Another Unix Nerd”!!!

    But upgrading WordPress from 3.3 to 3.4 on my DS209+ was almost “Yet Another Upgrade Nightmare” 🙂

    Click to Read More

    Upgrading a package for Synology is usually really a piece of cake. Unfortunately, the upgrade package for WordPress caused me difficulties.

    First issue: MySQL password

    The setup failed quite immediately after downloading, complaining that there was possibly an issue with the MySQL password. After some investigation, it appeared to me that :

    • the DSM Package Center is running as Synology’s “root” user and
    • the setup of WordPress was trying to access MySql with that account but without any password.
    I found on Synology’s Forum that “Current wordpress package requires an default mysql account root with empty password to create database successfully. If you have set mysql root password before, please install phpMyAdmin to reset the password first.

    And unfortunately (although quite normal), I did set a password for the MySql “root” user in the past… So, as suggested in the message above, I did reset MySql root password to blank.

    • Go to phpMyAdmin, opened the “Users” tab and clicked “Edit Privileges” for the user “root” with Host=localhost.
    • In the “Edit Privileges” dialog box, scroll down to the “Change Password” area and select “No Password” before clicking “Go”.
    • Finally, back to the “Users” page, click “Create PHP code” to apply the change. At that moment, phpMyAdmin could prompt you to re-enter your credentials (root with a blank password).

    I did next restart the update of the WordPress which finally completed fine. But…

    Next issue: Page Not Found

    My Blog was not reachable anymore after the upgrade ? Damned… WordPress was imply disabled… I had to click “Start” next to the WordPress Package in the DSM Package Center 😆

    And finally, my home page appeared… I went immediately to the administration dashboard where I discovered that the setup was actually not yet complete. In this dashboard, I found a message asking me to click a button to upgrade the database. Fortunately, nothing wrong occurred during this upgrade 🙂

    Last issue: This is somewhat embarrassing, isn’t it?

    Although the home page appeared correctly, I was not able to open anything else: no post, no “custom” pages, no categories, … For each of them, I got the WordPress’ “Page Not Found”… All the permalinks appeared somewhat “corrupted”… No idea why.

    Fortunately (bis ter et repetita), fixing this issue was not difficult. I simply had to re-enforce the right Permalinks structure.

    • Go back to the administration dashboard and select the menu “Permalinks” under “Settings”.
    • Check that “your” structure of Permalinks is still selected and did click “Save Changes” (Even if you didn’t change the structure).

    And miracle! Everything went back to normal. I didn’t lose any customization or plugins except my custom smilies from \web\wordpress\wp-includes\images\smilies (fortunately backuped),…


    No! I Don’t mean “Yet Another System Utility”!!! But “Yet Another Successful Update” 😆


  • Schedule a Backup of all your MySQL databases on Synology

    It would be a good idea to schedule a daily backup of all the MySQL databases on your Synology. Those will indeed be wiped out if by accident, you have to reset your NAS (reinstall the firmware), ex.: if you lose a disk in your RAID 0.

    That can be done using a shell script and a cron job as described here after.

    How to Backup

    First, create a user with a local-read-only access on the databases. We will indeed have to let its password in the script, endangering the security. Using a local-read-only user will mitigate the risks.

    1. Go to the web administration interface (DSM) of your NAS.
    2. Install phpMYAdmin via the “Package Center” if not yet done.
    3. Open phpMyAdmin via the “Start Menu” (“Main Menu”).
      1. I am using the login ‘root’ with the password of Syno’s ‘admin’ user
    4. Open the “Users” tab in phpMyAdmin
    5. Click “Add User” (bellow the list of existing users)
    6. Enter the User Name. Ex.: backup
    7. Select “localhost” as an Host.
    8. Enter a password. Ex.: mysql
    9. Keep “none” as “Database for user”
    10. Grant the user with Global privileges: Select (in Data) and Reload, Show Databases and Lock Tables (in Administration)
    11. Click “Add User” at the botton of the page

    Next, create a shell scripts in a Shared Folder of the NAS (Ex.: \volume1\backup\backupMySql.sh). Working in a Shared Folder will make it easier for you to copy/open later the backups from your PC). Don’t forget to create a “Unix” file, either using the touch command in a Console or saving a file As a “Unix shell script” within Notepad++. Notice that a script created with NotePad++ and saved on the Shared Folder will belong to the user account accessing that Shared Folder (Most probably your Windows Account if like me you simply created a user on your NAS with the same login and password). A script created with “touch” in a Console will belong to the user accessing the NAS via telnet/SSH (Most probably the “root” account).

    DATESTAMP=$(date +%Y%m%d%H%M%S)
    # create backup dir if it does not exist
    mkdir -p ${DIR}
    # remove backups older than $DAYS_KEEP
    #find ${DIR}* -mtime +$DAYS_KEEP -exec rm -f {} \; 2> /dev/null
    # remove all backups except the $KEEP latest
    BACKUPS=`find ${DIR} -name 'mysqldump-*.gz' | wc -l | sed 's/\ //g'`
    while [ $BACKUPS -ge $KEEP ]
      ls -tr1 ${DIR}mysqldump-*.gz | head -n 1 | xargs rm -f
      BACKUPS=`expr $BACKUPS - 1`
    # create backups securely
    #umask 006
    # dump all the databases in a gzip file
    /usr/syno/mysql/bin/mysqldump --user=$DB_USER --password=$DB_PASS --opt --all-databases --flush-logs | gzip >> $FILENAME

    NB: Since DSM 6.0, “/usr/syno/mysql/bin/mysqldump” has been moved to “/bin/mysqldump” !!!

    Possibly, type the following command in a Console (telnet/SSH) to set the user ‘root’ as owner of the script:

    [shell]chown root /volume1/backup/backupMySql.sh[/shell]

    IMPORTANT notice: I used to have “-u DB_USER” (with a blank space in between) in my script above and -“p$DB_USER” (without a blank) instead of –user and –password. But a reader (Fredy) reported that the script was not running fine for him unless removing the blank. As per documentation of mysqldump’s user parameter and password parameter, there should be a blank after -u but not after -p. However, samples on the web usually illustrate the use of mysqldump with “-uroot”. So, I decided to use the more explicit notation “–user=” and “–password=”. I did test this notation with a wrong username or password and the resulting dump is indeed empty. With the correct username and password, it works fine.

    Since DSM 4.2, the Task Scheduler can be used to run the script on a daily basis.

    1. Go to the Start Menu
    2. Open the Control Panel
    3. In the “Application Settings”, open the Task Scheduler
    4. Select “Create a User-Defined Script”
    5. Type a name for that “Task:”
    6. Keep the “User:” root
    7. In the “Run Command” pane, type:
      sh /volume1/backup/backupMySql.sh

    Don’t forget the “sh” in front of your command, otherwise, it does not work (although the sample provided by Synology is missing it ?!)

    If you don’t use the Task Scheduler, you can add a Cron Job to execute the script, e.g. every day at 0:01. Open a Console (Telnet/SSH) and type:

    [shell]echo "1       0       *       *       *       root    sh /volume1/backup/backupMySql.sh" >> /etc/crontab[/shell]

    FYI, a cron line syntax is “mm hh dd MMM DDD user task” where:

    • mm is the minute (0..59)
    • hh is the hour (0..23)
    • dd is the day in the month (1..31)
    • MMM is the month (jan, feb, … or 1..12)
    • DDD is the day in the week (sun, mon, … or 0..7 where 0 and 7 beeing both sunday)

    The following values can also be used:

    • * : a every unit (0, 1, 2, 3, 4…)
    • 5,8 : at unit 5 et 8
    • 2-5 : units 2 to 5 (2, 3, 4, 5)
    • */3 : every 3 units (0, 3, 6, 9…)
    • 10-20/3 : every 3 units, from 10th to 20th (10, 13, 16, 19)

    So, the script will start every day at 0:01h

    Finally, you must restart the cron daemon to activate the new job. To find the process id and send a SIGHUP signal to this one, type the following command line in a Console (Telnet/SSH):

    [shell]ps | grep crond | grep -v grep | awk '{print$1}' | xargs -t kill -HUP[/shell]

    It should display “Kill -HUP xxxx” where xxx is the pid of the cron daemon.

    Added on 03/01/2013

    Attention: if you copy paste the command to restart the cron daemon from this page into the telnet console, some symbols will be wiped out: the ‘{ and ‘ around print$1… you have to type them manually…

    Attention: if you upgrade the version of DSM, the changes made in the cron script are lost (at least, it’s what I have noticed after updating last month…). Reason why I recommend to use the new “Task Scheduler” feature available since DSM 4.2.

    Tip to edit the cron script: you can use the package “Config File Editor” available here. Once installed, you can access it via the Main Menu. Then, you have to edit the file named “Config File Editor” and add the following line:


    Once this line is added and saved, … I don’t remember how to force the change to be taken into account :/. But restarting the DiskStation is enough 😀

    Finally, back into the Config File Editor, select the ‘crontab’ entry and modify this script, save your changes and restart the cron daemon.

    Tip to restart the cron daemon: you can use the package “MODS Web Console” available here. To install it, go to the Package Center and add the following url via the Settings > Package Sources : https://www.beatificabytes.be/sspks. Once this url added, go to the tab “Community” and click Install on the “MODS Web Console” icon.

    Run the Web Console via the Main Menu, log in with “admin”/”admin” (The defaults values if not changed) and type:

    synoservice --restart crond

    Added on 01/12/2013

    If you want a lazy solution to notify the Administrator about the success or failure of the backup, you can use the ‘synonotify’ command (See details here). A more advanced solution would be to configure the “Mail Server” and use its ‘sendmail’ command:  /volume1/@appstore/MailServer/sbin/sendmail…

    Added on 08/01/2017

    mysqldump has moved

    • DSM 6.0 : /usr/syno/mysql/bin/mysqldump
    • MariaDB 5: /volume1/@appstore/MariaDB/usr/bin/mysqldump
      MariaDB 10: /volume1/@appstore/MariaDB10/usr/local/mariadb10/bin/mysqldump

How to Restore

To do a full restore, simply:

  1. Copy the archive (.gz) you plan to restore on your local PC
  2. Go to “phpyMyAdmin” > “Import” > “Chose File” (next to Browse your computer).
  3. Select the .gz file to be restored
  4. Press “Go” at the bottom of the page (no need to change any settings)

Pay attention: this is a complete restore, I.e.: all databases are dropped and recreated from scratch.

If you want to be able to restore a subset of your databases you better have to change the script to backup specific databases instead of –all-database.

If you want to restore only one table ‘mytable’ from the backup ‘mysqldump-datetime.gz’:

  1. Unzip first the archive: gunzip mysqldump-datetime.gz
  2. Then extract the part that restore the desired table with this command: sed -n -e ‘/DROP TABLE.*mytable/,/UNLOCK TABLES;/p’ mysqldump-datetime > mytabledump

Download the script here.


  • Touch your scripts! Don’t be lazy…

    I have just created a new shell script for my NAS. But its behavior is really weird. It seems that concatenating strings is actually overwriting them. Ex.:

    echo $A$B

    results in: 12cd

    Click to read more

    Also, redirecting any output into a file results in a new folder and an new empty file, both with a weird name. Ex.:

    [shell] DIR=/volume1/sharedFolder/
    echo Hello World &amp;gt; $FILENAME

    results in a file named “outputFile” and a folder named “” ( beeing displayed as ‘dots’ in Windows Explorer!). Both are well located under /volume1/sharedFolder/ and visible in Windows Explorer. However the folder does not appear when executing ‘ls -la’ in a console on the NAS (only the file appears) and the only way to delete this folder is to execute ‘rm -R /volume1/sharedFolder’ in the console.

    I quickly realized that this behavior was a consequence of creating the file on a Shared Folder of the NAS using the Windows Explorer’s contextual menu “New”>”Text Document”… Creating an empty file with the command “touch” directly in a console on the NAS does not suffer the same issues.

    There is indeed at least one difference that I know between the file format of Unix and DOS: the return character which is 0x0A in Unix, while it is 0x0A, 0x0D in DOS (a.k.a /n in Unix and /r/n in DOS)

    I realized that this was the issue because each empty line in the script was resulting in an error: “: not founde x:”, x being the line number. Meaning that the “empty lines” were actually not empty (due to the /r).

    Notice that the magic “touch” only works because I use next Notepad++ to edit the file. Indeed, this great freeware preserve the Unix file format while NotePad, WordPad, etc…, do not.

    I did use the Windows Explorer’s contextual menu to create the empty file because I was too lazy to create a new file with notepad++ and browse next for the target subfolder on the NAS where I had to save it 🙁

    Otherwise, with the “Save As” of NotePad++, I would have been able to pick the right format: “Unix Script File” 🙂


  • Edit WordPress sources on Synology via the shared folder “web”

    Although all Plugins’ files can be edited directly within WordPress, you may sometimes prefer to open them with your favorite editor. Also, you could desire to edit some sources of WordPress…

    And if it is quite easy to find the files to be modified under the share folder “web” (\\<SynologyHostname>\web), you will quickly notice that you may not save any change…

    This is simply because the folder ‘wordpress’ and its content (on Synology) belong by default to the user “nobody”. Click to read the solution

    To save your changes, you will first have to change the owner:

    • Check that Telnet is enabled on your Synology (Start Menu/Control Panel => Terminal)
    • Start the command (in a MS-Dos prompt): Telnet <SynologyHostname>
    • Log in with the root account and its password (same password as the Synology “admin” account)
    • Go to the physical folder associated to the shared folder “web”: cd /volume1/web/
    • Take ownership of WordPress’s whole content: chown -R <YourAccount> wordpress

    For sure, <YourAccount> must exist on Synology, be the same as your windows account (I.e.: same name and same password) and have privileges on the folder “web”. Otherwise, create such an account (Synology’s Start Menu/Control Panel => User) and don’t forget to grant him Read/Write access on “web” (Via the Synology User’s tab “Privileges Setup”)

    Once your changes saved, never forget to give back the ownership to “nobody”(*) otherwise WordPress won’t be able to update its plugins, themes, etc… automatically anymore.

    (*) Indeed, by default and for security reasons, the httpd demon of apache runs with the account “nobody”. All folders/files created by httpd (a.o.: during the installation of WordPress) belong therefore to “nobody”. All changes executed by https (e.g.: files editing) are executed with the credentials of “nobody”…


  • WordPress on Synology accessible with both a Netbios name and Domain name

    When I have decided to install the package WordPress on my Synology, it was intended to be used as a basic “Knowledge Management Software” as I explained here.

    One of my requirement was however not covered out of the box by this solution: WordPress on Synology might only be configured to be accessible with one domain name.

    Click to read why


    • Either with the Netbios name of the NAS, accessible from the Intranet only(my home network).
    • Or with the DNS name associated with your public IP, accessible from the Internet only (*) in my case.

    (*) Indeed, my DNS name is associated with the IP of my VDSL modem (my “public” IP). And although all http requests are forwarded to my NAS when they come from Internet, they are not when they come from my Intranet (So far, I didn’t find how to enable the Port Forwarding for this traffic and don’t even know if it’s possible with my modem; a Sagem Fast 3464):  If I browse my DNS name from my Intranet, I get the administration page of the modem.

    [EDIT] Now, when I browse my DNS name, I don’t get the Administration page of my Modem anymore but a message “Your internet connection is up, please close your browser and restart it again”. This is something configured by my Internet Provider in their own DNS Servers.

    Fortunately, there is an easy solution:

    Click to read the solution

    ==> Install the WordPress’ plugin “MultiDomain” and configure it to support “several domains”: a first one being simply my Netbios name and another one being your DNS name.

    This configuration has to be done in the file “config.php”, either with the “WordPress Plugins Editor” or with your favorite editor; the file can be accessed via the system shared drive “web” of Synology: \\<SynologyHostname>\web\wordpress\wp-content\plugins\multidomain\config.php). If you do it with your own editor, read this post about file access rights.

    That solution is from far easier than any advanced manual .htaccess customization and more effective than any other multi-site/multi-domain plugin I found 😉

    [EDIT] I have finally decided to access my blog only with its fully qualified domain name and never with its Netbios name anymore, including from my Intranet. So, I had to solve the access issue when using a domain name within my Intranet. I use the DNS Server of my Synology for that purpose.


  • WordPress on my Synology!

    This first post to proudly announce that I finally decided to install the WordPress Package on my Synology, a DS209+ with DSM 4.1, and start to blog.

    Nothing could have been easier than installing this package… Click to read more

    • Log on your Synology as an administrator
    • Open the “Package Center” via the “Start Menu”
    • Go to the “Available” tab
    • Click “Install” on the package “WordPress”.

    The setup wizard will prompt you to get the root’s password in order to create a mysql database. By default, the Synology has no password configured to access mysql with the ‘root’ account. So I decided to configure one, using “phpMyAdmin”:

    • Open “phpMyAdmin” via the “Start Menu”

    If “phpMyAdmin” is not available in this menu:

    • Go back to the “Package Center”
    • Go to the “Available” tab
    • Click Install on the package “phpMyAdmin”

    Once “phpMyAdmin” open:

    • select the tab “Users”
    • for each “root” entry (one per host), click on “Edit Privileges”
    • scroll down in the “Privileges” window and change the password

    Use the “root” account and its new password to complete the setup of WordPress. The only other information required to configure WordPress on your Synology is a title and a tagline for your blog 🙂

    You can now access your blog on http://YourSynology/wordpress.

    In a next post, I will explain how to easily access your blog from both intranet and internet, i.e.: using either your Synology netbios name  (hostname) or DNS name (domain name).


  • Tags

    Acer iDea 510 AirPlay Android Backup DD-WRT DNS DS209+ DS713+ DS1815+ FlexRaid Galaxy Galaxy S2 Galaxy S7 Google Assistant Google Home HTPC Kies MCE MySQL Nabi 2 Nvidia TV Shield One Plus One OpenHab Outlook Philips Hue Plex RAID Raspberry PI Remote Desktop Root Access Samsung Scripts Synology Team Build Visual Studio VMWare Wi-Fi Windows Windows 8 Windows 8.1 Windows 10 Windows Server 2012 XBMC Xpenology ZigBee


    Recent Posts