0

Condition: bind a function to Transcend StoreJet's Backup button
Differential conditions: no driver for the button in Linux through USB3
Exclude: all graphical backup softwares

The product Transcend StoreJet 25M3 Anti-Shock has a backup button. I would like to that the press of the button starts the function

#!/usr/bin/env bash

# bind this script to the press of the button in the external HDD

# mchid for pkexec
pkexec env DISPLAY=:0 XAUTHORITY=$HOME/.Xauthority \
    tar czf /media/masi/Transcend/backup_home_10.7.2016.tar.gz $HOME/

Pseudocode

  1. ask password for sudo
  2. How to Bind the button to the script?

System: Linux Ubuntu 16.04 64 bit
Linux kernel: 4.4 and 4.6
Linux kernel options: wl
Hardware: Macbook Air 2013-mid, ....
Related thread: Transcent StoreJet auto backup
External HDD: Transcend 1 TB StoreJet 25M3
Bash: 4.3.46(1)-release (x86_64-pc-linux-gnu)

  • 1
    I edited the script in my answer to automatically fill in the current date. 10.7.2016 for example. – mchid Jul 10 '16 at 19:32
  • Great! It is time to wait if there is any news about the driver or if it exists at all or any other approach to get the feature. – Léo Léopold Hertz 준영 Jul 10 '16 at 19:38
1

This is actually two questions and you should ask this as two questions instead of one.

With that said, you can use pkexec instead of sudo to get a prompt for a password before executing the script like so:

#!/bin/bash

pkexec env DISPLAY=:0 XAUTHORITY=$HOME/.Xauthority tar czf media/masi/Transcend/backup_home_$(date +%d.%m.%Y | sed 's/\(0\)\(.\)\(\.\)/\2\3/g').tar.gz $HOME/

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.