Bash Script IF Elif Else & Case Perbandingan Multi Kondisi
Berikut ini adalah contoh bash script script perbandingan if elif else multiple or multiple and gabungan antara and dan or membandingkan angka dan string :
Berikut ini adalah contoh bash script script perbandingan if elif else multiple or multiple and gabungan antara and dan or membandingkan angka dan string :
Sekedar catatan cara menginstall NodeJS di Centos dan kebetulan saya menggunakan centos 7 menginstall nodejs 13. Read more
Bagaimana cara menginstall webserver apache + PHP dan MySQL di sistem operasi windows? Berikut terdapat beberapa applikasi installer yang bisa anda gunakan. Read more
WordPress itu gratis tapi juga ada yang berbayar dari yang murah sampai muahal, Gratisnya seperti apa dan bayarnya seperti apa akan saya jelaskan di artikel ini. Read more

Anda sudah membuat website php atau html di localhost dengan xampp. Kemudian bagaimana cara mengonlinekan website tersebut ke internet. Artikel ini akan membahasnya secara tuntas.
Read moreBeberapa metode backup di directadmin telah kami coba, mulai dari automatic ftp backup, local backup plus remote backup, remote backup saja dan lainya. Maka berikut ini sekilas catatan tips backup dari kami : Read more
Kadang kita mengeksekusi script bash melalui cron setiap menit sedangkan script tersebut belum menyelesaikan tugasnya. Yang terjadi script berjalan duplikat dan berkali-kali.
Berikut ini adalah contoh script yang bisa anda gunakan untuk mendeteksi script yang sudah berjalan.
#!/bin/sh
proses=`ps aux | grep namafile.sh | grep -v grep | wc -l`
if [[ $proses -gt 2 ]]; then
echo "script sudah jalan";
exit;
fi
Untuk mengujinya silahkan buat misalnya testrun.sh dan dibawahnya tambahkan sleep 30 dengan tujuan agar script tersebut selesai setelah 30 detik.
kira-kira seperti ini
#!/bin/sh
proses=`ps aux | grep testrun.sh | grep -v grep | wc -l`
if [[ $proses -gt 2 ]]; then
echo "script sudah jalan";
exit;
fi
#menguji sleep 30 second
sleep 30;
Bukalah beberapa window bash dan jalankan script testrun.sh secara bersamaan, maka yang anda dapatkan adalah sebagai berikut :
[root@script]# ./testrun.sh script sudah jalan
Pertanyaan yang mungkin muncul adalah mengapa -gt adalah 2 dan bukan 1?
Adapun perhitungannya adalah sebagai berikut :
Ketika testrun.sh berjalan maka terhitung 1 kemudian melakukan pengecekan ps aux dan apabila nilainya 1 maka script yg sedang dijalankan tersebut dianggap telah berjalan dan keluar output “script telah berjalan” yang sebenarnya tidak ada script lain yg berjalan kecuali proses yang saat itu dilakukan.
Demikian dan selamat mencoba.
Berikut ini adalah kumpulan bash script kalkulasi waktu dan tanggal dengan output jam detik dan menit:
Kalkulasi 2 waktu output dalam jam menit dan detik
START=$(date +%s);
sleep 1; # Your stuff
END=$(date +%s);
echo $((END-START)) | awk '{printf "%d:%02d:%02d", $1/3600, ($1/60)%60, $1%60}'
untuk contoh script lainya menyusul.
Bagaimana cara menghapus spasi dan baris kosong pada file menggunakan bash script ?
Menghapus baris kosong.
[root@]# cat file.txt satu dua tiga empat [root@]# sed -i '/^$/d' file.txt [root@]# cat file.txt satu dua tiga empat
Menghapus Spasi
[root@script]# cat file.txt satu lima dua puluh tiga ratus empat ribu [root@script]# cat file.txt | tr -d "[:blank:]" satulima duapuluh tigaratus empatribu
Menghapus Spasi dan New Line
[root@script]# cat file.txt satu lima dua puluh tiga ratus empat ribu [root@script]# cat file.txt | tr -d "[:space:]" satulimaduapuluhtigaratusempatribu[root@uvcms1 script]#
Menghapus new line saja
[root@script]# cat file.txt satu lima dua puluh tiga ratus empat ribu [root@uvcms1 script]# cat file.txt | tr -d "\t\n\r" satu limadua puluhtiga ratusempat ribu[root@script]#
Selamat mencoba.
Hari ini salah satu pelanggan kami ada yang meyampaikan bahwa mereka menerima banyak email “Mail delivery failed: returning message to sender” yang kurang lebih isinya seperti ini Read more
Kadang DNS server directadmin down disebabkan pelanggan salah memasukkan record atau terdapat record yang tidak tersinkronisasi dengan sempurna.
Kelihatannya hal sepele, yaitu hanya sekedar dns. Tapi jika tidak dimonitor dengan benar maka server dns yang down tidak akan mengirimkan query dns dari pengunjung.
akibatnya? query tidak berhasil ditemukan dan website pun tidak bisa diakes.
Jadi bagaimana solusinya?
This site uses cookies. By continuing to browse the site, you are agreeing to our use of cookies.
Accept settingsHide notification onlySettingsWe may request cookies to be set on your device. We use cookies to let us know when you visit our websites, how you interact with us, to enrich your user experience, and to customize your relationship with our website.
Click on the different category headings to find out more. You can also change some of your preferences. Note that blocking some types of cookies may impact your experience on our websites and the services we are able to offer.
These cookies are strictly necessary to provide you with services available through our website and to use some of its features.
Because these cookies are strictly necessary to deliver the website, refusing them will have impact how our site functions. You always can block or delete cookies by changing your browser settings and force blocking all cookies on this website. But this will always prompt you to accept/refuse cookies when revisiting our site.
We fully respect if you want to refuse cookies but to avoid asking you again and again kindly allow us to store a cookie for that. You are free to opt out any time or opt in for other cookies to get a better experience. If you refuse cookies we will remove all set cookies in our domain.
We provide you with a list of stored cookies on your computer in our domain so you can check what we stored. Due to security reasons we are not able to show or modify cookies from other domains. You can check these in your browser security settings.
We also use different external services like Google Webfonts, Google Maps, and external Video providers. Since these providers may collect personal data like your IP address we allow you to block them here. Please be aware that this might heavily reduce the functionality and appearance of our site. Changes will take effect once you reload the page.
Google Webfont Settings:
Google Map Settings:
Google reCaptcha Settings:
Vimeo and Youtube video embeds:
