Category: Synology

  • Synology’s Could Sync Consuming Internet Quota With Google Drive

    I noticed that between 50GB and 100Gb of my Internet Quota was consumed per day since two weeks. After investigation, I found it was due to the Cloud Sync service of my Synology Nas “looping” infinitely.

    Click to Read More

    The first step was to identify the device downloading some many Gb per day.

    I did enable the logging service on my router and turn on the logging of its firewall for all outgoing connections.

    I did export the log of the firewall into notepad++, cleaned up a bit the log to keep the source and destination IP only.

    I did copy that into Excel and created a pivot table to see which source was doing many connection and onto which external IP (eliminating known destinations as the DNS of google 8.8.8.8 and 8.8.4.4, the Synology’s KeepAlive service 118.163.30.162, Broadcast 192.168.0.255, …) I saw that most connections were onto 172.217.16.193, 172.217.21.202, 172.217.22.42, … from my NAS.

    Using a IP who IS service, I found that 172.217 belongs to Google. Why was my NAS connection to Google ? I did look all the packages installed on my NAS and “tilt”: Cloud Sync was configured to sync two google accounts… Having a quick look into the current status of Cloud Sync, I noticed it was “syncing” 1 file… apparently for ever.

    I did connect on my NAS via Telnet and looked into /var/log/cloudsync/daemon.log

    In there, I found that cloud sync was logging, in a loop, errors like:

    Dec 10 11:19:26 [ERROR] gd-pull-event-by-list-handler.cpp(89): ListDirectory: ListRemoteSubitems failed (retrying) [-1000] User rate limit exceeded
    Dec 10 11:19:26 [ERROR] gd-transport.cpp(2195): error reason: [rateLimitExceeded].
    Dec 10 11:19:26 [ERROR] gd-transport.cpp(2196): error message: [Rate Limit Exceeded].
    Dec 10 11:19:26 [ERROR] gd-transport.cpp(2238): Hit rate limitation.
    Dec 10 11:19:26 [ERROR] gd-transport.cpp(3082): [-1000] User rate limit exceeded. URL=’https://www.googleapis.com/drive/v2/files?fields=nextLink%2Citems%28id%2Ctitle%2CmimeType%2CfileSize%2CmodifiedDate%2Cmd5Checksum%2CdownloadUrl%2CalternateLink%2Cparents%28id%29%2Clabels%28trashed%29%29&q=trashed%20%3D%20false%20and%20%271QmcGFz7PI0P_0TUlaAJkNfzWRw%27%20in%20parents’

    I will look into a solution to this issue and temporarily unlinked the Google Drive account from Coud Sync…

    voilà voilà.

    Loading

    ,
  • Send Custom Notifications from scripts running on a Synology [new]

    This is an update of a old post written for DSM 4 and 5: how to use the native Notification Mechanism of Synology to sent custom notifications. It’s now tested on my DS1815+ with DSM 6.0.

    Click to Read More

    First, define the Notifications to be sent:

    1. Open a dos command prompt, and execute: telnet <YourSynoHostname>
      1. As an alternative, I am using the free telnet client “Putty” to open SSH Console.
    2. Login as administrator
    3. Once connected via telnet, enter the root mode with the command ‘sudo -i’, using here also the password of your administrator
    4. Execute next: cd /usr/syno/synoman/webman/texts/
    5. Execute: ls
    6. Now you see a list of folders for each language supported by your Synology. You must at least defined your custom notifications in the ‘enu’ version and next the version that match your language.
    7. Copy the file with the definition of the existing notifications in a shared folder to edit it easily: 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. As an alternative, you can use the Package “Config File Editor” to edit “/usr/syno/synoman/webman/texts/enu/mails”
    8. Edit now this file ‘mails’ (e.g.: with notepad++: \\<yourSynoHostname>\web\mails)
    9. Add your new custom “tags” at the end of the file with an adequate definition (see bellow for an example). You must specify a Title, a Subject, the text, and a Category with its priority. The category is used to group the Notifications in the DSM > Control Panel > Notification > Advanced Tab. For each Category, specify one of the possible values with a “Priority”, separated by a coma. The priority is used to filter the notifications in the “Advanced” tab (Look at existing tags in the file for illustration):
      1. Possible values for “Category”
        1. Backup/Restore: group under ‘Backup and Restoration’ in the “Advanced” tab
        2. CMS
        3. External Storage
        4. HA: grouped under ‘High-availability cluster’
        5. AHA: not displayed in the “Advanced” tab but related to External Storage
        6. Storage: grouped under ‘Internal Storage’
        7. USB Copy: not displayed in the “Advanced” tab but related to External Storage
        8. Power System: grouped under ‘Power supply’
        9. System
        10. PerfEvent: not displayed in the “Advanced” tab but related to System
      2. Possible values for “Priority”
        1. Important: displayed as Critical
        2. (no value): displayed as Informative
          Synology Notifications
          Synology Notifications
    10. Save your changes (E.g.: back to the telnet console, execute: cp /volume1/web/mails enu/mails)

    Examples:

    [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 completed
    Subject: Database backup on %HOSTNAME% has succeeded

    Dear User,

    Database backup on %HOSTNAME% has successfully completed.

    Next, define how to sent those custom Notifications if and only if they are in a Category which does not appear in the “Advanced” tab of the “Control Panel” > “Notifications” pane > “Advanced” tab (Ex.: the categoryPerfEvent). It’s indeed via that Tab that you should to enable  the desired delivery modes: “email”, “sms”, …. which is obviously only possible for Notifications in a Category which is displayed.

    1. Go back to the telnet console and execute: cp /usr/syno/etc/notification/notification_filter.settings /volume1/web/

      1. As an alternative, you can use the Package “Config File Editor” to edit “/usr/syno/etc/notification/notification_filter.settings”
    2. Edit the file ‘notification_filter.settings’ (E.g. with notepad++)
    3. At the end of that file, insert a configuration line for each custom tag, specifying how the notification must be sent (Look at the other line for illustrations). Possible delivery mode are:
      1. mail
      2. sms
      3. mobile
      4. cms: this is the native popup notification mechanism of DSM, enabled by default for all notifications
      5. msn: not supported anymore since 17th July 2014
      6. skype: not supported anymore since 17th July 2014
    4. Copy the file back to its original location: cp /volume1/web/notification_filter.settings /usr/syno/etc/

    Examples:

    MySqlBkpOK=”mail”

    MySqlBkpError=”mail”

    Now, reboot your Synology

    It seems that in the past, I was able to apply my changes in those files without a reboot. But while testing this trick on DSM 6.x, I didn’t find how to do it without a reboot.

    Finally, modify your script to sent your notifications:

    1. Edit your script (E.g. with notepad++).
    2. Add where required the following command: /usr/syno/bin/synonotify <YourCustomTag>
    3. Save your changes.

    In the example here after, I sent notifications depending on the success or failure of the previous command:

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

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

    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 new tags which appear now in the list.
      1. If the tags do not appear, close and reopen the control panel. restart your DSM!
      2. The tags appear with their Title under their Category
    Notifications Configuration
    Notifications Configuration

    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: the user EConceptApplications suggested on Synology Forum to use a script as here under to automatically reinsert the notifications

    grep -q “MySqlBkpOK” /usr/syno/etc/notification/notification_filter.settings
    if [ $? -ne 0 ] then

    echo MySqlBkpOK=”mail” >> /usr/syno/etc/notification/notification_filter.settings

    fi

    Notice: a reader, k13tas, suggested that it was much easier to reuse an existing notification tag and customize its text via Control Panel > Notification > Advanced. Indeed, those changes are not lost after a DSM update.

    Notice: a reader, Rusmin, posted here that he found how to pass parameters to be used  in the notification message, via a hash json string. In his sample, one passes the value “value1” via a variable named %VAR1%. The value can obviously come from any variable of your shell script. Ex.: $PPID, $MyVariable, $$, etc…

    Usage: /usr/syno/bin/synonotify tag_event [hash_json_string]

    /usr/syno/bin/synonotify Tag_Name ‘{“[%VAR1%]”: “value1”, “[%VAR2%]”: “value2”}’

    NB: another reader, Paul Marcos, reports however that for him:

    this wouldn’t work with the brackets:

    /usr/syno/bin/synonotify Tag_Name ‘{“[%VAR1%]”: “value1”}’

    but this, without the brackets would:

    /usr/syno/bin/synonotify Tag_Name ‘{“%VAR1%”: “value1”}’

    Loading

  • Synolody DSM update: Insufficient free disk space to upgrade

    Since I have migrated from my DS713+ to a DS1815+, I can’t update seamlessly my DSM. Most of the time, my NAS pretends that I have “Not enough storage space”. This problem is due to large log files filling my system partition.

    Click to Read More

    After the migration top my new NAS, I have reinstalled JDownloader. This one is using a script to run a java application via “nohup”. Nohup’s log is growing fast and takes a lot of storage, preventing my NAS to download the DSM updates.

    I found it was the culprit via an ‘iterative’ procedure suggested by maxxfi on the forum of Synology:

    Use your admin password. Once authenticated as root, type:

    • cd /
    • du -ks [a-u]*

    That command will give you for each subdirectory whose name begins with a letter from a to u (so to avoid the volumeX) the total amount of disk space in use. Wait that it finishes and search for which directory shows the biggest numbers, and type:

    • cd <directory>
    • du -ks *

    Repeat the analysis going deeper into the directory tree until you are able to pinpoint the culprit. Finally, use the appropriate “rm <filenames>” command to delete the largest folder/files.

    In my case, the largest file was /root/nohup.out

    But in the past , I also had to deleted /var/log or /var/log/messages and reboot prior updating the DSM.

    In a Putty session, to know the free space in the system partition, type: df -k

    Loading

  • Synology upgrade to DSM 6.0

    A few notes about the upgrade from DSM 5 to 6

    Click to Read More

    • First, stop Plex (as it prevents DSM 6.0 to install)
    • Upgrade to DSM 6.0
    • Upgrade all the required Packages
    • Start Plex
    • Not working anymore:
      • Login in a telnet session as ‘root’
      • ‘homes’ link in /var/services is pointing at /volume1/@fake_home_link
        • open a ssh session as root,
        • do: rm homes
        • and: ln -s /volume1/homes homes
      • Access right to shared folders
        • admin has no access anymore to various shared folders. Ex.: /volume1/homes/admin
        • Go to DSM > Control Panel > User
        • Edit the ‘admin’ account and got the the ‘permissions’ tab
        • Reapply the access rights
      • Web Console.

        • Doesn’t open anymore… It must now be accessed under the web path /webman/3rdparty, via its url: http://hades:5050/webman/3rdparty/webconsole/wc.cgi.
        • I did a new package to start it automatically. See attachments at the bottom of this post. Once installed, open Web Console and change your password (default is “admin”) using the command:  #users modify admin
      • JDownloader (does not start anymore)
        • Java Manager not installed anymore. It is replaced by the new Java package for a more convenient installation procedure.
        • Edit the file S99jdownloader.sh to replace “/volume1/@appstore/JavaManager/Java/bin/java” by “/usr/local/bin/java”
        • In that file also change the path to create the pid file into a folder where admin is granted write access !
        • Login into a ssh session and enter the root mode (sudo -i)
        • Execute “rm /var/run/S99jdownloader.pid”
        • Check that all files in /volume1/@appstore/jdownloader belong to ‘admin’
        • Exit the root mode
        • Execute “sh S99downloader.sh start”
        • Check the output in the nohup.out file
      • Filebot does not run anymore
        • Reinstall the “Unofficial Java Installer”
      • FileBot Node does not start anymore
        • Uninstall filebot and filebot-node
        • Uninstall node.js and java 8
        • Delete all the old scheduled tasks related to filebot
        • Delete the input and the output folders (where media files to be renamed are located)
        • Recreate empty input and output folders (as admin – via the File Station, not as root)
        • CTRL-F5 in the browser to fully refresh DSM
        • Install the unofficial java installer of RedNoah + node.js v4
        • Install filebot (version from Package Center) and filebot-node (the version filebot-node-0.2.0-B1-noarch of RedNoah)
        • If it does still not run, test it via a SSH
          • login as admin
          • DO NOT RUN ANYTHING AS ROOT. So, don’t execute: sudo -i
          • cd /var/packages/filebot-node/target/
          • ./start
          • Check the errors returned by this command if any
          • Check also the logs: cat /var/log/messages
        • filebot-node is installed in /volume1/@appstore/filebot-node with
          • a sytmbolic link from /var/packages/filebot-node/target/ and
          • a symbolic link from /usr/local/filebot-node
          • filebot-node schedule a task to run its command /usr/local/filebot-node/task xxx where xxx is the id of a task defined into /volume1/@appstore/filebot-node/data/task/xxx.argsp
      • AcpiOnLan (DSM SSO login not working anymore)
        • the port to access DSM in admin mode (required to do a login via the page /webman/login.cgi) is not anymore stored in /etc/synoinfo.conf with the key secure_admin_port or admin_port respectively for http and https. AcpiOnLan was fetching the port in that file. Instead, AcpiOnLan must now fetches external_port_dsm_https or external_port_dsm_http
      • WordPress
        • After the update of WordPress, as usually, I had to save (although not changed) the current option selected in the “Settings” > “Permalink Settings” otherwise no page was accessible anymore via permalinks (as returned by google search).
        • The automated WordPress update failed to complete. I should have enabled ftp first. I did a manual upgrade.. But the problem was most probably with the owner of the files… (See next)
        • Upgrading plugins didn’t work either… But this problem was solved by executing, as root: chown -R http:http /volume1/web/wordpress

    Loading

  • Expand storage by migrating disks from Synology DS713+ to DS1815+

    The 2x3TB disks of my DS713+ were full. Being lazy, I decided to expand the storage by migrating the disk to a new DS1815+ with more bays (instead of doing a full backup and restore on larger disks). It was a piece of cake!

    Click to Read More

    1. Do first a backup of the configuration of your current Synology via Control Panel > Update & Restore menu > Configuration Backup tab > Back up configuration button
    2. Move the disks to the new Synology, keeping the very same order (disk in bay n must go into the bay n of the new Synology).
    3. Add a few other disks in the new Synology and create new Volumes
    4. Boot the new Synology and wait for the beep.
    5. Start the Synology Assistant, find your new Synology and click “Connect” on it.
    6. Use the Migration mode, keeping all your files. NB.: you should download the latest DSM for your new Synology and use that local copy during the installation process instead of letting the installation process download that file itself.
    7. Restore the Configuration backup on the new Synology
    8. If you were using the web station and php, enable it. This settings was lost in my case: Control Panel > Web Services menu > Web Services tab > Enable Web Station option
    9. Repair the packages one by one. Wait for each repair to be successful before repairing the next package otherwise you could be in troubles. Pay attention also that the behaviour of the UI can be weird when auto-refreshing after a repair. If clicking repair on a package, you see that the package repaired is not the one you clicked on (but one that was already repaired), close and reopen the Package Center. All my packages where successfully repaired (sometimes I had to skip one and retry later, IMO due to the dependencies…). Here are the packages I had to repair
      1. Audio Station. everything kept as-is, including the user-defined radio
        1. if music does not appear, go to Control Panel > Media Indexing and re-index the media files.
      2. Download Station: didn’t lose anything from its download queue
      3. Plex Media Server. I simply had to reenter my credentials which were expired
      4. DNS Server: all settings/zones still defined. Access to all services from intranet and internet working fine
      5. Maria DB: nothing lost. In particular my Worpress blog.
      6. Media Server: ok
      7. Video Station: all video and metadata accessible
      8. Photo Station: all albums still there and ok
      9. Python 3: I had to retry the repair but works fine
      10. Java Manager: ok (used to install Java 7)
      11. Surveillance Station: Licenses, settings, camera, recordings are all kept
      12. Time Backup: I had to retry the repair but backup tasks are ok, as wel as the timeline itself.
      13. Node.js
    10. Other Packages:
      1. My Custom packages were still there: iPKGui, AcpiOnLan, Mods (My Own Dsm Shorcuts), Unofficial Java Installer (Java 8)
      2. Custom Package Sources are still defined too
      3. Jdownloader was still installed and configured and I only had to restart it.
      4. Settings were lost for FileBot Node. After reconfiguring FileBot Node, it was not working (unable to access its onw port) I had to uninstall it and reinstall (including FileBot). Reconfigured settings were however not lost…
      5. WordPress was stopped. My blog was however well still accessible as I did reenable the Web Station
    11. Synology’s DDNS Service
      1. DDNS Service being linked to the old Synology, I had to go to https://account.synology.com/fr-fr/overview and unlink my DDNS name
      2. Next, I went to  Control Panel > External Access and did Edit my provider (Synology) to re-enabled the DDNS and re-introduced my login/password.
      3. It took a few minutes before being again connected.
    12. I finally moved a few Shared Folders to the new volumes by editing them via Control Panel > Shared Folder menu > Edit. I simply changed the location, picking the new Volume as a target. Attention, during the move, the Control Panel is not accessible anymore. If you need to access it, simply open a new browser 😉 (The only thing that cannot be done, is moving two Shared Folders simultaneously). Notice that the move can take ages as the new volume is probably still under validation (depends if you checked that option when you created the volume).

    Et voilà.

    Loading

  • Netgear JGS524E’s 802.3ad Link Aggregation And Synology

    Long time ago, I wanted to configured a Bond on my Synology to benefit the LAG feature of my Switch JGS524E (Netgear ProSafe® Plus). Unfortunately, it didn’t work. Being lazy, I never investigated further. It’s now done: I wrote to Netgear and they confirmed that only Static LAG is supported on JGS524E. Dynamic LAG, required to use Link Aggregation with Synology, is not.

    Click to Read More

    Concretely, Synology says in documentation that it requires IEEE 802.3ad (Dynamic) Link Aggregation (LACP, 802.1AX). While Netgear told me that the Switch ProSafe® Plus only supports static LAG. And that’s how I learned that static LAG is not LACP (Link Aggregation Control Protocol) :/

    Conclusion I did configure my Synology to use Adaptive Load Balancing and I did disable LAG on my Netgear…

    Loading

  • DNS name resolution not working anymore after Package update

    After updating my Synology with the latest version of the DNS Server, this one was not resolving my domain names anymore. I had to reset to “resolution service” to solve that issue.

    Click to Read More

    To access my blog, hosted on my NAS, from my intranet but using its public domain name, I had to define the same domain name on my DNS Server, with A records pointing to the NAS’ IP… (see details here).

    When my DNS Server does not run anymore, trying to access my blog from my intranet, using its domain name, I get the web page of my ADSL Modem. Is IP address is indeed the one obtained when resolving my domain name using a public DNS Server.

    To check if my DNS Server runs fine, I simply had to run a dos cmd prompt and type ping www.beatificabytes.be. If I get the local IP of my NAS, it works fine. If I get the public IP of my ADSL modem, there is something wrong…

    It’s not the first time that I have this issue after updating my DSM or the DNS Server. But each time, the solution is the same: I have to uncheck and recheck the options “Enable resolution services” in my Synology’s “Control Panel > DNS Server > Resolution” settings.

    NB.: I have next to reboot my mobile devices. on PC, possibly execute “ipconfig /release” and then “ipconfig /renew” in a command prompt.

    Loading

    ,
  • Control ACPI-Enabled network devices from a Synology

    Acpi On Lan
    Acpi On Lan

    ACPI-On-Lan” is a package I have created for my Synology DS 713+ (also tested on my DS 3612sx).

    It installs a website that list all your network devices. Depending on the OS, you can possibly send a sleep, shutdown or hibernate command to the device. ACPI-On-Lan tries also to reach each device (using a ping) and checks if there is a default web page accessible on the device (Ex. a configuration or administration page). Finally, it can send Wake-On-Lan magic packets to wake-up devices currently switched off.

    Click to Read More

    Disclaimer

    This package is a prototype made for learning purpose. I did test many development techniques and libraries I never touched before: ajax/jquery, boostrap, .Net click-once deployment, creation of Synology spk packages, WebAPI/Microsoft .Net Owin, Newtonsoft.Json, running shell commands from php, etc… So don’t expect the most amazing bits out of there. It’s just this well known Big Ball of Mud  😳

    This is not a beta version (even not an alpha), which would be well designed. My prototype is a Quick and Dirty App made of various pieces of code dropped together. It must be complete rewritten properly or at least deeply re-factored. Briefly said, I don’t want my name to be associated with this ugly mess (even if most scientists seem to produce such a code :D).

    Nevertheless, and although still really incomplete (as most prototypes), it works on my own NAS and I have already been asked to share it. So, here it is:

    Some details

    A few details on ACPI-On-Lan’s basics first:

    • it reuses the login cgi module of the Synology to authenticate the user
    • it parses the ARP table of the Synology to find the devices available on the LAN.
    • it pings the devices using the “inetutil” library (from ipkg)
    • it does not use any database
    • it stores all the details about the network devices in a file with json format. If you plan to uninstall the package, you must backup those files manually first.
    • for hibernate, sleep, standby, restart Windows PC, it talk to a Windows Service hosting WebAPI services.
    • this Windows Service was intended to be deployed via click-once. Because I didn’t want to resign the click-once setup for each new deployment url, the Windows Service is installed now via MSI. However, the Windows Service is still self-installing (simply run the exe once and it will do the complete setup)
    • all commands (ping, WOL, …) are executed server side (by the NAS). So the Web UI can be used from the WAN without requiring direct access to each devices on the LAN.

    Notice also that:

    • the web UI doesn’t render well on mobiles.
    • there is not support yet to shutdown MAC, LINUX or ANDROID devices. I am planning to look how to use RPC commands (later this year 😉 )
    • Windows mobiles are not yet supported.
    • there are still some bugs when refreshing the status of some devices and a wrong state can sometimes be displayed. Also an action to “shutdown” the NAS is displayed although not yet implemented.
    • it’s not possible to define a specific port for the website possibly hosted on a device (Ex.: a custom local port of a port forwarded from the modem/router in order to access the device from the WAN)
    • I have to yet filled the spk’s “texts” files to translate the package.

    Prerequisite:

    You will have to install the package ‘inetutil’ on your NAS. This is required to be able to ping the devices while not running as super user (i.e.: ‘root’).

    The package ‘inetutil’ can be easily installed via the graphic interface “IpkgGUI” once IPKG is installed. And there are many tutorial on the web to install IPKG. If you are not afraid, you can try my own installation script*, described here (“IpkgGUI” is a graphical interface to manage IPKG packages. It is available as a Community Package for Synology on https://www.cphub.net)

    (*) Notice that you can install the package “ACPI-On-Lan” first and than connect on your NAS via telnet. The script to install IPKG is deployed with “ACPI-On-Lan”. Once connected, run: sh /var/packages/AcpiOnLan/target/application/service/installipkg.sh

    If you want to be able to send Sleep/Restart/Hibernate/shutdown command to Windows PC, you will need the Microsoft .Net Framework 4.5. This service is not required if you only want to send WOL commands to Windows machines.

    Setup:

    1) Download the package attached at the bottom of this page and install it manually via the “Package Manager” of Synology. 5 clicks and ~that’s it~.

    Manual Installation of ACPI On Lan
    Manual Installation of ACPI On Lan

    2) It can theoretically be installed on any volume (if you have several).

    Install On Any Volume
    Install On Any Volume

    3) And you can “run it after installation”

    RunAfterInstallation

    The setup of the package will mainly:

    • deploy the sources under /var/packages/AcpiOnLan/
      • the web application will be in /var/packages/AcpiOnLan/target/application
      • all the data of AcpiOnLan will be stored next to the web application in a file named Computers.json
    • create a php alias AcpiOnLan to “redirect” the http calls into the folder here above
    • force open_basedir = null for the new web site “AcpiOnLan”
    • add an icon into the DSM Start Menu
    Acpi On Lan Icon
    Acpi On Lan Icon

    4) Once ACPI-On-Lan opened in a browser, you will have access to a menu “install srvc”. Click on it to download the MSI which installs the Windows Service (Do this on Windows only!).

    Install AcpiOnLan Windows Service
    Install AcpiOnLan Windows Service

    5) The download of AcpiOnLanInstaller.msi will most probably be blocked by your browser/antivirus as it’s not a common download. If you want it, you have to accept the download (“Keep” within Chrome)

    AcpiOnLanInstaller Blocked
    AcpiOnLanInstaller Blocked

    6) Once you run the msi, recent version of Windows will also prevent its execution

    AcpiOnLanInstaller Stopped by Windows
    AcpiOnLanInstaller Stopped by Windows

    7) You will have to approve the installation by clicking on “More Info” here above and then “Run Anyway”

    AcpiOnLanInstaller Forced
    AcpiOnLanInstaller Forced

    8) Once the msi is running, it will copy the required files and do a first run of the service. When the service is run interactively (it’s the case when run by rom the msi), it install/uninstall itself instead of starting WebAPI Services. But it means that the antivirus will again react. Due to installation timeout this could disturb the setup…

    AcpiOnLanInstaller AntiVirus
    AcpiOnLanInstaller AntiVirus

    9) The Windows Service will be installed and will register itself the port the url where it will run its WebAPI services (It uses ‘netsh’ for that purpose)

    Installation
    Installation

    Et voilà, the Windows Service should now be running.

    IMPORTANT NOTICE 1: as the Windows Service was designed to be deployed via Click-Once, it was not assumed to be launched “As Administrator” directly (An exe “run” via Click-Once can by the way not require elevated rights). So, if run without such rights, the exe of the Windows Service will stop itself automatically and restarts “As Administrator” (You could be prompted to provide adhoc credentials).

    Previledge Required
    Previledge Required

    IMPORTANT NOTICE 2: when the Windows Service is installed via the msi, NEVER run the exe yourself from a command prompt of from the Windows Explorer. Again because the service has not been designed to be installed via a msi (with ‘installutil’ tool or with an installer class) a “self-installation/uninstallation” process has been foreseen if and only if the exe is run “interactively”. So, if you run the exe after the installation of the msi, it will do a self-uninstallation of the service.You have to run it once more to reinstall it.

    IMPORTANT NOTICE 3: The worst wase occurs if you run the exe once ad then uninstall the msi via the Control Panel > Add & Remove Programs. Indeed the msi will simply run the exe which will actually do a self-reinstallation of the service. So you will still have the service defined in the “Local Services” but neither the exe nor the entry in “Add & Remove Programs” anymore. To fix this, Quickly reinstall the msi, which will do a self-uninstallation of the service. Than run the exe interactively (from Windows Explorer) to redo a self-installation of the service. And you will end with the service defined in the “Local Services”, the exe available and the entry in “Add & Remove Programs” (which can now be used to safely uninstall the service). Sorry for that. I will improve the process to prevent the msi to put such a mess asap.

    Quick guide:

    1) When you access Acpi-On-Lan, you have to log in with a DSM account

    AcpiOnLan Login
    AcpiOnLan Login

    2) When you run Acpi-On-Lan for the very first time, it will search for your LAN (possibly one per Ethernet port on your NAS)

    AcpiOnLan Looking For Network
    AcpiOnLan Looking For Network

    3) Next, it will scan the LAN(s) (look into the ARP table)

    AcpiOnLan Scanning Network
    AcpiOnLan Scanning Network

    4) Finally, it will display a list of network devices found. For each device, you will have to “Set the OS” and “Set an Icon” (Except if you are happy with the default icons).

    AcpiOnLan Set OS and Icon
    AcpiOnLan Set OS and Icon

    5) If there is an hyperlink symbol next to a device, it means that there is a we page available. You can click on it. Also to refresh the status of a device, you can use the menu “Check”.

    6) Depending on the OS:

    • if the device if on, you will have actions to Hibernate, Sleep, Standby, Shutdown or Restart the device.
    • Once you have clicked on an action, an Abort action is made available for a few second.
    • If the device is off, you will only have a Wol action.

    The recycle bin can be used to hide a device and you can edit the name of the device.

    AcpiOnLan Actions
    AcpiOnLan Actions

    7) Finally, you have various menu

    AcpiOnLan Menu
    AcpiOnLan Menu
    • Reload: will reload the list of devices (and add newly detected ones if any)
    • Flush: will empty the ARP table and reload the list of devices (you will have to ‘reload’ again until all the devices appear. Possibly ping manually your devices from a telnet session to populate the ARP table… I will possibly add such a feature in the UI soon or later)
    • Check: check the status of all the devices displayed in the list not checked since 5 minutes. Notice: up to 3 devices are checked simultaneously by the UI (limitation for mobile devices slow to execute jquery)
    • Forced Check: check the status of all the devices displayed in the list even if checked within the latest 5 minutes.
    • Reset All: delete all the devices from the list (including your customization like icons/OS/hostnames). The network will net be rescanned. Notice that your previous data will actually be backuped in a subfolder “backups” and named Computers.x.json. You can manually restore them.
    • Show All: will show all devices previously hidden by clicking on its recycle bin. Clicking again on its recycle bin will un-hide the device.
    • Hide: Hide all devices marked to be hidden (to be used after the menu Show All)
    • Log Out: guess 😉

    NOTICE: your devices will be listed only if they have been switched-on at least one and in touch with the NAS during that time (I.e.: if they have been added into the ARP table).  Some devices although switched-on are never in touch with the NAS. EX.: power lines Ethernet adapters, … I will plan a procedure to ping all the IP in the LAN so all such devices are touched (if switched-on). In the mean time, you will have to ping them yourself from a telnet session. Ex.: ping -c 1 192.168.0.1

    Loading

  • Script to automate IPKG installation on Synology

    Installing ipkg is not difficult, but I hate to do it manually each time I (re)install a Synology… So, here attached is a script to install it automatically.

    [EDIT] ipkg is not maintained anymore. Many packages do not run anymore with the most recent DSM. So, use opkg instead.

    Click to Read More

    First Installation:

    1. Copy on your NAS the script attached at the bottom of this post (Ex.: into \\<YourSyno>\web\admin as used for the illustration here after).
    2. Connect as root on your NAS (Ex.: via telnet using the command ‘telnet <YourSyno>’, the login ‘root’ and the password of your ‘admin’ account – see more details here).
    3. Execute the script (Ex.: use the command ‘sh /volume1/web/admin/installipkg.sh’)
    4. Check which processor your have on your NAS and select the right option accordingly. The script will show you the cpu found using ‘cpuinfo’. But you can double-check here (NB.: I have a DS713+ which is currently not listed. I didn’t test ipkg for the other versions).
    Automatic Installation of Ipkg
    Automatic Installation of Ipkg

    You can now use ipkg directly in a shell or via the (really) great UI named “IpkgGUI”. This one is available as a Community Package from cphub.net. Add “https://www.cphub.net” as a Package Source in the Package Center’s settings pane and install IpkgGUI.

    Ipkg GUI
    Ipkg GUI

    Re-installation/upgrade:

    If ipkg is already installed, the script will remove it automatically and reboot the NAS before proceeding further with the installation (A reboot takes a bit more than one minute to shutdown and a bit more than two minutes to restart on my DS 713+). After the reboot, thanks to a script inserted into /etc/rc.local, the setup will continue automatically.

    Automatic Installation of Ipkg With Reboot
    Automatic Installation of Ipkg With Reboot

    Installation status:

    (After the reboot, reconnect to the NAS). You can now check the status of the setup in its log, using the command: cat /root/ipkg.log. The output should looks like this:

    [code]
    
    [Mon Dec 15 17:34:44 CET 2014] Installing IPKG...
    Optware Bootstrap for syno-i686.
    Extracting archive... please wait
    bootstrap/
    bootstrap/bootstrap.sh
    bootstrap/ipkg-opt.ipk
    bootstrap/ipkg.sh
    bootstrap/optware-bootstrap.ipk
    bootstrap/wget.ipk
    Creating temporary ipkg repository...
    Installing optware-bootstrap package...
    Unpacking optware-bootstrap.ipk...Done.
    Configuring optware-bootstrap.ipk...Done.
    Installing ipkg...
    Unpacking ipkg-opt.ipk...Done.
    Configuring ipkg-opt.ipk...Done.
    Removing temporary ipkg repository...
    Installing wget...
    Installing wget (1.12-2) to root...
    Installing wget (1.12-2) to root...
    Installing wget (1.12-2) to root...
    Installing wget (1.12-2) to root...
    Installing wget (1.12-2) to root...
    Installing wget (1.12-2) to root...
    Installing wget (1.12-2) to root...
    Installing wget (1.12-2) to root...
    Installing wget (1.12-2) to root...
    Configuring wget
    Successfully terminated.
    Creating /opt/etc/ipkg/cross-feed.conf...
    Setup complete.
    
    [/code]

    Notice: after the setup of ipkg, this one is upgraded and updated once automatically.

    PS.: If you don’t choose the right version of the boostrap, the installation of ipkg will fail. While trying to run it, you could see errors like “line 1: syntax error: unexpected word (expecting “)”)“. Try to install the right package. The script should delete the previous installation and install the new one as explained above.

    Loading

  • Shell Script for Synology not working

    You become crazy because after hours of trials and errors, your brand new (and probably first) shell script still complains about “syntax error: unexpected “fi” (expecting “then”)”, “syntax error: unexpected “fi” (expecting “then”)” or “syntax error: unexpected word (expecting “in”)”, … The problem is probably with the EOL.

    Click to Read More

    The problem could indeed be that you are editing your script with a Windows Text Editor… In such a case, you have to convert the Windows EOL (End Of Line character) into the Linux equivalent.

    Edit your script with Notepad++ and use the menu “Edit”  > “EOL Conversion” > “Unix/OSX Format”. Then save your script and try again…

    You may also have to use the ANSI encoding with the menu “Encoding” > “Convert to ANSI”

    Loading

    ,