Automatically opening and closing a door
I've built a circuit in Proteus VSM for you. The circuit consists of 3 blocks:

1) A Monostable Multivibrator for managing trigger signals and generating enable signals:



img source: http://www.electronics-tutorials.ws

2) An astable multivibrator for managing open- and close-durations:




img source: http://www.electronics-tutorials.ws

NOTE: If you want both durations to be equal then use the following:




img source: http://www.electronics-tutorials.ws

3) Motor Driver: 



Final circuit (Click for full view):


First block is a monostable multivibrator with trigger input and "ENABLE/STOP" output. The output goes directly to the second block's ENABLE/RESET input and the motor driver's ENABLE input. The duration of ENABLE signal is the sum of on- and off-durations: \$T = 1.1 \cdot R5 \cdot C4 = 1.1 \cdot 27k \cdot 330\mu F = 9.8s\$

Second block is an astable multivibrator with equal on- and off-durations: \$T_{on} = T_{off} = 0.693 \cdot R1 \cdot C2 = 0.693 \cdot 20k \cdot 330\mu F = 5s\$.

Third block is a 2-way motor driver. Setting IN1=1 and IN2=0 forces the motor to turn on one direction; likewise setting IN1=0 and IN2=1 forces the motor to turn on the reverse direction. 

Here's the Proteus VSM simulation file:
http://www.filedropper.com/m_5