This is a template for having a single command block that is capable of running multiple commands. If you run this command as given it will generate a small structure that prints a message in the chat and then destroys itself and the command block that initiated it. This can easily by modified to add additional commands to perform your own logic by adding additional MinecartCommandBlocks to the front of the inner list of Passengers.
If you found this useful then please favorite it and I'll create more tutorials and templates for common advanced commands.
/summon FallingSand ~ ~1 ~ {
Block:stone,
Time:1,
Passengers:[
{
id:FallingSand,
Block:redstone_block,
Time:1,
Passengers:[
{
id:FallingSand,
Block:activator_rail,
Time:1,
Passengers:[
<ADD NEW COMMANDS STARTING HERE>
{
id:MinecartCommandBlock,
Command:"say This is an example command"
},
<END NEW COMMANDS>
{
id:MinecartCommandBlock,
Command:"setblock ~ ~ ~1 command_block 0 replace {Command:fill ~ ~-3 ~-1 ~ ~ ~ air}"
},
{
id:MinecartCommandBlock,
Command:"setblock ~ ~-1 ~1 redstone_block"
},
{
id:MinecartCommandBlock,
Command:"kill @e[type=MinecartCommandBlock,r=1]"
}
]
}
]
}
]
}