Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!


Best way to test bash scripts?
New on LowEndTalk? Please Register and read our Community Rules.

All new Registrations are manually reviewed and approved, so a short delay after registration may occur before your account becomes active.

Best way to test bash scripts?

edited August 2012 in General

So I've been working on a bash script that just sets up and configures servers for me, it's not too much different from the many already available but I'm doing it more for the learning aspect and the time savings when setting up new servers.

I currently have a dev VPS that I test this on, but it's becoming a pain in the ass to reload the OS, re-run the updated script and wait while it does everything again, only to find out I forgot a damn "\" in front of a "$" somewhere and repeat the process.

It's the whole reloading the OS and re-executing the script that is taking the most time. Even on a local VM, this is troublesome.

Just curious what you guys do when developing bash scripts.

Comments

  • KuJoeKuJoe Member, Host Rep

    Why not run it locally with VMWare Player or Virtual Box? On my PC and netbook I have 4 "clean" installs of Vyatta, CentOS, Arch Linux, and Fedora that I use for testing. If I need a Fedora install (Linux + GUI) then I'll just copy over the folder and use that copy to test with, then delete the copy.

  • I do use Virtual Box sometimes, but even then it can become a bit of a headache. I didn't know if those were the best options or if, I don't know, there was some other option available =]

  • KuJoeKuJoe Member, Host Rep

    I remember somebody telling me that they used some sort of setup where they mounted an image of the OS and after a reboot the OS went back to the image state and all charges were reverted. No idea how he did this but I do remember having similar software on the computers at my high school.

  • Hmm, I'll see what I can conjure up.

    On an un-related note, I sent you a PM a week or so ago, haven't heard back.

  • raindog308raindog308 Administrator, Veteran

    Virtualbox or similar is really what you want. You can create snapshots and rollback to them. As you make progress, create snapshots.

  • @Zen said: Proxmox home server

    is very quick but no needs backups for clean fresh install, just drop it.

  • @raindog308 said: Virtualbox or similar is really what you want. You can create snapshots and rollback to them. As you make progress, create snapshots.

    exactly what i do with centmin mod.. virtualbox snapshot/restore saves alot of time :)

  • qjqqjq Member

    run the script bit by bit, line by line
    or keep editing the command and only append it to the bash script after you get it right

  • Proxmox... yiak. too much stuff to do before start.

    Vmware and snapshots is the coolest thing ever, but isn't free.

  • Take a snapshot of your stuff, break, restore, break again, repeat.

    VMware is awesome.

  • Debootstrap and Chroot.

  • karlkarl Member

    i have a private openvz node at my house, nothing powerful just a old c2d laptop
    that i use for testing scripts/setups so i don't have to touch anything thats in a live environment

  • Grab the ISO (centos etc) and fire up VMWare on your desktop

  • inverseinverse Member
    edited August 2012

    @raindog308 said: Virtualbox or similar is really what you want. You can create snapshots and rollback to them. As you make progress, create snapshots.

    +1 snap :)

Sign In or Register to comment.