Is it possible to change the system timezone in the terminal?


#1

I use c9 to push all of my projects to GitHub and I have had issues where the push doesn’t get counted for the day because the timezone is not set. It would be really helpful to have my workspace be in line with the current time I am working.


#2

You can change timezone from commandline same as in any other ubuntu vm http://askubuntu.com/a/323163/209079

e.g. by running

sudo dpkg-reconfigure tzdata

#3

Thanks! Just to clarify, does that command need to be run on every workspace that is created, or is there a way to have that setting automatically set as new workspaces are created or cloned from GitHub repos?


#4

You could add the command to your Init script, then it will run automatically in every workspace when you create/open them.


#5

unfortunately adding it to init script is not easy since init script runs in the browser
i use the following snippet to automatically install my dotfiles on all my new workspaces

if (/-nightwing\.c9.io$/.test(services.c9.hostname)) {
    setTimeout(function() {
        services.fs.exists("~/dotfiles", function(exists) {
            if (exists == false) {
                services.tabManager.open({
                    editorType: "terminal",
                    active: true,
                    document: {
                        terminal: {
                            cwd: "~"
                        }
                    }
                }, function(e, tab) {
                    var repo = "git@bitbucket.org:<myuser>/dotfiles.git"
                    tab.editor.write([
                        "echo -e '#!/bin/bash\\nssh -o UserKnownHostsFile=/dev/null -o StrictHostKeyChecking=no \"\$@\"' > /tmp/git_ssh",
                        "chmod 755 /tmp/git_ssh",
                        "cd ~",
                        "GIT_SSH=/tmp/git_ssh git clone " + repo,
                        "cd dotfiles",
                        "bash ./init.sh",
                    ].join(" &&\\\n") + "\n")
                })
            }
        })
    }, 1000)
}

the if (/-nightwing\.c9.io$/.test(services.c9.hostname)) { test is important to not install my dotfiles on collaborator repositories (my username is nightwing).


Init script example