Backup CyberPanel ke Google Drive

Secara standard, cyber panel belum menyediakan setting backup ke gogle drive seperti halnya cpanel. Sehingga, agar tetap bisa menngunakan backup ke google drive, kita perlu untuk membuatkan scrpt secara manual dan di pasang di server. setelah itu baru di jalankan perintah cronjob, agar proses backup terjadi secara periodik.

Script untuk Upload CyberPanel ke Google Drive

agar server dapat melakukan backup ke google drive, kita harus membuat scriptnya terlebih dahulu. Berikut langkah-langkahnya:

  • Silahkan login ke root server anda
  • Setelah login silahkan masuk ke directory /root
  • jalankan perintah berikut untuk melakukan cloning/ copy ke directory /root dengan nama gdrive-backup-cyberpanel
git clone https://github.com/xaksh/gdrive-backup-cyberpanel -b cyberpanel+gdrive gdrive-backup-cyberpanel

atau juga anda bisa menggunakan perintah berikut:

wget 'https://github.com/xaksh/gdrive-backup-cyberpanel/archive/cyberpanel+gdrive+jbc.zip'
unzip -j cyberpanel+gdrive+jbc.zip -d gdrive-backup-cyberpanel
  • Jalankan perintah setup.sh dengan mengatur juga Server Hostname, Host Node, Cron Job
cd gdrive-backup-cyberpanel
source setup.sh "srv.namadomain.com" "srv" "30 1 * * *"

srv.namadomain.com = silahkan isi dengan hostname server anda atau di isi dengan Domain utama anda

srv = nama host node

30 1 * * * = Waktu backup server yang akan di jalankan setiap hari @1:30 AM

Contoh:

source setup.sh "srv.hosteko.com" "srv" "30 1 * * *"
  • rclone akan meminta untuk membuat remote baru, beri nama remote dengan “gdrive” tanpa tanda petik.
  • Lakukan konfigurasi kurang lebih seperti berikut:
No remotes found - make a new one
n) New remote
s) Set configuration password
q) Quit config
n/s/q> n
name> gdrive
Type of storage to configure.
Enter a string value. Press Enter for the default ("").
Choose a number from below, or type in your own value
 1 / 1Fichier
   \ "fichier"
 2 / Alias for an existing remote
   \ "alias"
 3 / Amazon Drive
   \ "amazon cloud drive"
 4 / Amazon S3 Compliant Storage Provider (AWS, Alibaba, Ceph, Digital Ocean, Dreamhost, IBM COS, Minio, etc)
   \ "s3"
 5 / Backblaze B2
   \ "b2"
 6 / Box
   \ "box"
 7 / Cache a remote
   \ "cache"
 8 / Citrix Sharefile
   \ "sharefile"
 9 / Dropbox
   \ "dropbox"
10 / Encrypt/Decrypt a remote
   \ "crypt"
11 / FTP Connection
   \ "ftp"
12 / Google Cloud Storage (this is not Google Drive)
   \ "google cloud storage"
13 / Google Drive
   \ "drive"
14 / Google Photos
   \ "google photos"
15 / Hubic
   \ "hubic"
16 / In memory object storage system.
   \ "memory"
17 / JottaCloud
   \ "jottacloud"
18 / Koofr
   \ "koofr"
19 / Local Disk
   \ "local"
20 / Mail.ru Cloud
   \ "mailru"
21 / Mega
   \ "mega"
22 / Microsoft Azure Blob Storage
   \ "azureblob"
23 / Microsoft OneDrive
   \ "onedrive"
24 / OpenDrive
   \ "opendrive"
25 / Openstack Swift (Rackspace Cloud Files, Memset Memstore, OVH)
   \ "swift"
26 / Pcloud
   \ "pcloud"
27 / Put.io
   \ "putio"
28 / QingCloud Object Storage
   \ "qingstor"
29 / SSH/SFTP Connection
   \ "sftp"
30 / Sugarsync
   \ "sugarsync"
31 / Transparently chunk/split large files
   \ "chunker"
32 / Union merges the contents of several remotes
   \ "union"
33 / Webdav
   \ "webdav"
34 / Yandex Disk
   \ "yandex"
35 / http Connection
   \ "http"
36 / premiumize.me
   \ "premiumizeme"
Storage> 13
** See help for drive backend at: https://rclone.org/drive/ **

Google Application Client Id
Setting your own is recommended.
See https://rclone.org/drive/#making-your-own-client-id for how to create your own.
If you leave this blank, it will use an internal key which is low performance.
Enter a string value. Press Enter for the default ("").
client_id>
Google Application Client Secret
Setting your own is recommended.
Enter a string value. Press Enter for the default ("").
client_secret>
Scope that rclone should use when requesting access from drive.
Enter a string value. Press Enter for the default ("").
Choose a number from below, or type in your own value
 1 / Full access all files, excluding Application Data Folder.
   \ "drive"
 2 / Read-only access to file metadata and file contents.
   \ "drive.readonly"
   / Access to files created by rclone only.
 3 | These are visible in the drive website.
   | File authorization is revoked when the user deauthorizes the app.
   \ "drive.file"
   / Allows read and write access to the Application Data folder.
 4 | This is not visible in the drive website.
   \ "drive.appfolder"
   / Allows read-only access to file metadata but
 5 | does not allow any access to read or download file content.
   \ "drive.metadata.readonly"
scope> 1
ID of the root folder
Leave blank normally.

Fill in to access "Computers" folders (see docs), or for rclone to use
a non root folder as its starting point.

Note that if this is blank, the first time rclone runs it will fill it
in with the ID of the root folder.

Enter a string value. Press Enter for the default ("").
root_folder_id>
Service Account Credentials JSON file path
Leave blank normally.
Needed only if you want use SA instead of interactive login.
Enter a string value. Press Enter for the default ("").
service_account_file>
Edit advanced config? (y/n)
y) Yes
n) No (default)
y/n> n
Remote config
Use auto config?
 * Say Y if not sure
 * Say N if you are working on a remote or headless machine
y) Yes (default)
n) No
y/n> n
Please go to the following link: https://accounts.google.com/o/oauth2/auth?access_type=offline&client_id=XXXXXXXXX644.apps.googleusercontent.com&redirect_uri=urn%3Aietf%3Awg%3Aoauth%3A2.0%3Aoob&response_type=code&scope=https%3A%2F%2Fwww.googleapis.com%2Fauth%2Fdrive&state=9Vu-W1__8Q0tO6m-UhmkEw
Log in and authorize rclone for access
Enter verification code>
  • Silahkan copy dan paste kode google verifikasi pada browser dan paste kembali kode yang di dapat setelah melakukan verifikasi pada kolong yang di sediakan.
  • Setelah kode verifikasi di input, silahkan ikuti langkah berikut:
Configure this as a team drive?                                                 y) Yes
n) No (default)
y/n> n
--------------------
[gdrive]
type = drive
scope = drive
token = {"access_token":"XXXX.a0Adw1xeXkGEOwGsQbkvKTN5-Yz-yjDWubrUTwJ8DaGI6ZmAOykE1ayrXRj2cEcspYdF2X4IafTxt0pD9pWTXggXO_0WvrwZD2JfkDm_-e7SXGqtzNZeCcyJZG-ZpnYYlMxRbQmci90_uqxnNeZhjEMKX2ztB0eACRl_Q","token_type":"Bearer","refresh_token":"1//0fr0OFeqIb-vzCgYIARAAGA8SNwF-L9IrdCY8YrVq6rPuSvBMXGATDg1ADThJjAZ_tSCx2MZK2uThJ0jFc_z2Lu2XTJ2VaM_HovM","expiry":"2020-02-20T08:31:52.238295365Z"}
--------------------
y) Yes this is OK (default)
e) Edit this remote
d) Delete this remote
y/e/d> y
Current remotes:

Name Type
==== ====
gdrive drive

e) Edit existing remote
n) New remote
d) Delete remote
r) Rename remote
c) Copy remote
s) Set configuration password
q) Quit config
e/n/d/r/c/s/q> q

  • jalankan backup.sh untuk melakukan pengujian proses backup
bash backup.sh

atau bisa menggunakan perintah

sh backup.sh
  • Setelah proses backup berhasil, anda dapat menjalankan cron agar backup selalu berjalan sesuai dengan waktu yang telah anda tentukan di awal. silahkan jalankan perintah berikut:
bash cron.sh

atau bisa menggunakan perintah

sh cron.sh
  • Selamat, saat ni semua website anda telah di jadwalkan untuk terbackup di google drive.

 

Sumber referensi: https://github.com/xaksh/gdrive-backup-cyberpanel

4.9/5 - (41 votes)
Tri Wahyudi

Recent Posts

Cara Secure Partisi /tmp di WHM/Cpanel

cPanel & WHM juga menawarkan skrip bawaan yang memaksimalkan keamanan partisi /tmp. Hal ini dilakukan…

1 month ago

mengatasi error ImunifyAV has not detected any compatible hosting panel as well as integration.conf file to run the installation without a panel di cyberpanel

berikut adalah cara mengatasi error ImunifyAV has not detected any compatible hosting panel as well…

3 months ago

Update URL Repository Centos 7 Setelah End Of Life (EOL) 2024-07-01

CentOS 7 tidak akan mendapatkan pembaruan apa pun setelah Juni 2024. Selain itu, mirrorlist.centos.org tidak…

3 months ago

Mengatasi error gmysql Connection failed: Unable to connect to database pada pdns Cyberpanel

DNS di server cyberpanel tidak mau bekerja, di cek pada error log keluar pesan seperti…

3 months ago

Mengatasi Access denied for user ‘cyberpanel’@’localhost’ (using password: YES) saat upgrade cyberpanel

saat upgrade cyberpanel, keluar pesan error seperti berikut: django.db.utils.OperationalError: (1045, "Access denied for user 'cyberpanel'@'localhost'…

3 months ago

Cara Restart CyberPanel Lewat SSH

Untuk melakukan restart cyberpanel lewat SSH silahkan jalankan perintah berikut: systemctl restart lscpd

3 months ago